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

Unified Diff: chrome/common/extensions/extension_constants.cc

Issue 575113002: Move Webstore URL concepts to //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ENABLE_EXTENSIONS guard in core chrome code Created 6 years, 3 months 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 | « chrome/common/extensions/extension_constants.h ('k') | chrome/common/extensions/manifest_url_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_constants.cc
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index 533fd874304e76edf3a39cf1ac62a54b2af3934a..dcfca2f1a55f1b963a9f74b25dbd6e5f07cfcb17 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -4,93 +4,19 @@
#include "chrome/common/extensions/extension_constants.h"
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/strings/string_util.h"
-#include "chrome/common/chrome_switches.h"
-#include "net/base/escape.h"
-#include "net/base/url_util.h"
-
namespace extension_urls {
-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 GetExtensionGalleryURL() {
- return GetWebstoreLaunchURL() + "/category/extensions";
-}
-
-std::string GetWebstoreItemDetailURLPrefix() {
- return GetWebstoreLaunchURL() + "/detail/";
-}
-
-GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
- return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
-}
-
-GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl) {
- GURL url(GetWebstoreLaunchURL() + "/jsonsearch");
- url = net::AppendQueryParameter(url, "q", query);
- url = net::AppendQueryParameter(url, "hl", hl);
- return url;
-}
-
-GURL GetWebstoreSearchPageUrl(const std::string& query) {
- return GURL(GetWebstoreLaunchURL() + "/search/" +
- net::EscapeQueryParamValue(query, false));
-}
+namespace {
const char kGalleryUpdateHttpsUrl[] =
"https://clients2.google.com/service/update2/crx";
-// TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS.
-const char kExtensionBlocklistUrlPrefix[] =
- "http://www.gstatic.com/chrome/extensions/blacklist";
-const char kExtensionBlocklistHttpsUrlPrefix[] =
- "https://www.gstatic.com/chrome/extensions/blacklist";
-
-GURL GetWebstoreUpdateUrl() {
- CommandLine* cmdline = CommandLine::ForCurrentProcess();
- if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
- return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL));
- else
- return GetDefaultWebstoreUpdateUrl();
-}
+
+} // namespace
GURL GetDefaultWebstoreUpdateUrl() {
return GURL(kGalleryUpdateHttpsUrl);
}
-bool IsWebstoreUpdateUrl(const GURL& update_url) {
- GURL store_url = GetWebstoreUpdateUrl();
- if (update_url == store_url) {
- return true;
- } else {
- return (update_url.host() == store_url.host() &&
- update_url.path() == store_url.path());
- }
-}
-
-bool IsBlacklistUpdateUrl(const GURL& url) {
- // The extension blacklist URL is returned from the update service and
- // therefore not determined by Chromium. If the location of the blacklist file
- // ever changes, we need to update this function. A DCHECK in the
- // ExtensionUpdater ensures that we notice a change. This is the full URL
- // of a blacklist:
- // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt
- return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) ||
- StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true);
-}
-
-const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore";
-
const char kWebstoreSourceField[] = "utm_source";
const char kLaunchSourceAppList[] = "chrome-app-launcher";
« no previous file with comments | « chrome/common/extensions/extension_constants.h ('k') | chrome/common/extensions/manifest_url_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698