Chromium Code Reviews| 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 |