| Index: chrome/common/extensions/chrome_extensions_client.cc
|
| diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc
|
| index d29b3531fd8df8950cbb43ce6b51d25de5f13508..786fd38d3c8a1f0ef672a98d27da4e5160bf05be 100644
|
| --- a/chrome/common/extensions/chrome_extensions_client.cc
|
| +++ b/chrome/common/extensions/chrome_extensions_client.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "chrome/common/extensions/chrome_extensions_client.h"
|
|
|
| +#include "base/command_line.h"
|
| +#include "base/strings/string_util.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| #include "chrome/common/extensions/api/generated_schemas.h"
|
| #include "chrome/common/extensions/chrome_manifest_handlers.h"
|
| @@ -19,6 +22,7 @@
|
| #include "extensions/common/common_manifest_handlers.h"
|
| #include "extensions/common/extension.h"
|
| #include "extensions/common/extension_api.h"
|
| +#include "extensions/common/extension_urls.h"
|
| #include "extensions/common/features/api_feature.h"
|
| #include "extensions/common/features/base_feature_provider.h"
|
| #include "extensions/common/features/feature_provider.h"
|
| @@ -45,6 +49,14 @@ namespace extensions {
|
|
|
| namespace {
|
|
|
| +const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore";
|
| +
|
| +// 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";
|
| +
|
| const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh";
|
|
|
| template <class FeatureClass>
|
| @@ -273,6 +285,35 @@ bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const {
|
| return GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV;
|
| }
|
|
|
| +std::string ChromeExtensionsClient::GetWebstoreBaseURL() const {
|
| + 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 ChromeExtensionsClient::GetWebstoreUpdateURL() const {
|
| + CommandLine* cmdline = CommandLine::ForCurrentProcess();
|
| + if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
|
| + return cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL);
|
| + else
|
| + return extension_urls::GetDefaultWebstoreUpdateUrl().spec();
|
| +}
|
| +
|
| +bool ChromeExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
|
| + // 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);
|
| +}
|
| +
|
| // static
|
| ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
|
| return g_client.Pointer();
|
|
|