| 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
|
|
|