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

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: mt 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
« no previous file with comments | « extensions/common/extension_urls.h ('k') | extensions/common/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_urls.cc
diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
index ba72a63ef21971225eb3a4d124d569a57e223a9f..75a1bec1f52ab949b3a8278efe591832d6d8725f 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,19 @@ 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;
+}
+
+std::string GetWebstoreItemDetailURLPrefix() {
+ return GetWebstoreLaunchURL() + "/detail/";
+}
+
} // namespace extensions
« no previous file with comments | « extensions/common/extension_urls.h ('k') | extensions/common/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698