Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: extensions/common/extension_urls.cc

Issue 65163003: Move GetWebstoreLaunchURL and GetWebstoreItemDetailURLPrefix to extensions/common/extension_urls.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/common/extension_urls.cc
diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
index ba72a63ef21971225eb3a4d124d569a57e223a9f..a17aa0db1c9dbaff7494813ca9856219a7808e78 100644
--- a/extensions/common/extension_urls.cc
+++ b/extensions/common/extension_urls.cc
@@ -4,11 +4,21 @@
#include "extensions/common/extension_urls.h"
+#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/common/constants.h"
+#include "extensions/common/switches.h"
#include "url/gurl.h"
+namespace {
+
+// The greatest common prefixes of the main extensions gallery's browse and
+// download URLs.
+const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore";
+
+} // namespace
+
namespace extensions {
const char kEventBindings[] = "event_bindings";
@@ -22,4 +32,18 @@ bool IsSourceFromAnExtension(const base::string16& source) {
true /* case-sensitive */);
}
+std::string GetWebstoreLaunchURL() {
+ std::string gallery_prefix = kGalleryBrowsePrefix;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
+ gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAppsGalleryURL);
+ if (EndsWith(gallery_prefix, "/", true))
+ gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1);
+ return gallery_prefix;
miket_OOO 2013/11/07 21:39:41 I know this is just move-refactoring, but (a) is t
Yoyo Zhou 2013/11/08 02:03:09 For (a) and (b), I don't know. I spent some time s
+}
+
+std::string GetWebstoreItemDetailURLPrefix() {
+ return GetWebstoreLaunchURL() + "/detail/";
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698