123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- # Disables Chrome Webstore-related URLs and other internal functionality. Mainly for disabling auto updates via the Chrome Webstore.
- --- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc
- +++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
- @@ -151,13 +151,7 @@ ContentVerifierDelegate::Mode ChromeCont
- // between which extensions are considered in-store.
- // See https://crbug.com/766806 for details.
- if (!InstallVerifier::IsFromStore(extension)) {
- - // It's possible that the webstore update url was overridden for testing
- - // so also consider extensions with the default (production) update url
- - // to be from the store as well.
- - if (ManifestURL::GetUpdateURL(&extension) !=
- - extension_urls::GetDefaultWebstoreUpdateUrl()) {
- - return ContentVerifierDelegate::NONE;
- - }
- + return ContentVerifierDelegate::NONE;
- }
-
- return default_mode_;
- --- a/extensions/common/extension_urls.cc
- +++ b/extensions/common/extension_urls.cc
- @@ -30,7 +30,7 @@ bool IsSourceFromAnExtension(const base:
-
- namespace extension_urls {
-
- -const char kChromeWebstoreBaseURL[] = "https://chrome.google.com/webstore";
- +const char kChromeWebstoreBaseURL[] = "trk:09:https://chrome.google.com/webstore";
- const char kChromeWebstoreUpdateURL[] =
- "trk:05:https://clients2.google.com/service/update2/crx";
-
- --- a/extensions/browser/updater/extension_downloader.cc
- +++ b/extensions/browser/updater/extension_downloader.cc
- @@ -95,27 +95,18 @@ const char kNotFromWebstoreInstallSource
- const char kDefaultInstallSource[] = "";
- const char kReinstallInstallSource[] = "reinstall";
-
- -const char kGoogleDotCom[] = "google.com";
- const char kTokenServiceConsumerId[] = "extension_downloader";
- const char kWebstoreOAuth2Scope[] =
- - "https://www.googleapis.com/auth/chromewebstore.readonly";
- + "trk:10:https://www.googleapis.com/auth/chromewebstore.readonly";
-
- ExtensionDownloaderTestDelegate* g_test_delegate = nullptr;
-
- #define RETRY_HISTOGRAM(name, retry_count, url) \
- - if ((url).DomainIs(kGoogleDotCom)) { \
- - UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountGoogleUrl", \
- - retry_count, \
- - 1, \
- - kMaxRetries, \
- - kMaxRetries + 1); \
- - } else { \
- UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountOtherUrl", \
- retry_count, \
- 1, \
- kMaxRetries, \
- - kMaxRetries + 1); \
- - }
- + kMaxRetries + 1);
-
- bool ShouldRetryRequest(const network::SimpleURLLoader* loader) {
- DCHECK(loader);
- @@ -298,12 +289,6 @@ void ExtensionDownloader::DoStartAllPend
- ReportStats();
- url_stats_ = URLStats();
-
- - for (auto it = fetches_preparing_.begin(); it != fetches_preparing_.end();
- - ++it) {
- - std::vector<std::unique_ptr<ManifestFetchData>>& list = it->second;
- - for (size_t i = 0; i < list.size(); ++i)
- - StartUpdateCheck(std::move(list[i]));
- - }
- fetches_preparing_.clear();
- }
-
- @@ -335,23 +320,16 @@ bool ExtensionDownloader::AddExtensionDa
- return false;
- }
-
- - // Make sure we use SSL for store-hosted extensions.
- - if (extension_urls::IsWebstoreUpdateUrl(update_url) &&
- - !update_url.SchemeIsCryptographic())
- - update_url = extension_urls::GetWebstoreUpdateUrl();
- -
- // Skip extensions with empty IDs.
- if (id.empty()) {
- DLOG(WARNING) << "Found extension with empty ID";
- return false;
- }
-
- - if (update_url.DomainIs(kGoogleDotCom)) {
- - url_stats_.google_url_count++;
- - } else if (update_url.is_empty()) {
- + if (update_url.is_empty()) {
- url_stats_.no_url_count++;
- // Fill in default update URL.
- - update_url = extension_urls::GetWebstoreUpdateUrl();
- + update_url = GURL("chrome://blank/");
- } else {
- url_stats_.other_url_count++;
- }
- @@ -616,13 +594,9 @@ void ExtensionDownloader::OnManifestLoad
- const int error =
- response_code == -1 ? loader->NetError() : response_code;
- const std::string uma_histogram_name =
- - url.DomainIs(kGoogleDotCom)
- - ? std::string(
- - "Extensions."
- - "ExtensionUpdaterFirstUpdateCheckErrorsGoogleUrl")
- - : std::string(
- - "Extensions."
- - "ExtensionUpdaterFirstUpdateCheckErrorsNonGoogleUrl");
- + std::string(
- + "Extensions."
- + "ExtensionUpdaterFirstUpdateCheckErrorsNonGoogleUrl");
- const auto& extension_ids =
- manifests_queue_.active_request()->extension_ids();
- for (auto it = extension_ids.begin(); it != extension_ids.end(); ++it) {
- @@ -680,20 +654,6 @@ void ExtensionDownloader::HandleManifest
- fetch_data->request_ids()));
- }
-
- - // If the manifest response included a <daystart> element, we want to save
- - // that value for any extensions which had sent a ping in the request.
- - if (fetch_data->base_url().DomainIs(kGoogleDotCom) &&
- - results->daystart_elapsed_seconds >= 0) {
- - Time day_start =
- - Time::Now() - TimeDelta::FromSeconds(results->daystart_elapsed_seconds);
- -
- - for (const std::string& id : fetch_data->extension_ids()) {
- - ExtensionDownloaderDelegate::PingResult& result = ping_results_[id];
- - result.did_ping = fetch_data->DidPing(id, ManifestFetchData::ROLLCALL);
- - result.day_start = day_start;
- - }
- - }
- -
- NotifyExtensionsDownloadFailed(
- no_updates, fetch_data->request_ids(),
- ExtensionDownloaderDelegate::NO_UPDATE_AVAILABLE);
- @@ -1108,11 +1068,7 @@ bool ExtensionDownloader::IterateFetchCr
- // fetch.
- switch (fetch->credentials) {
- case ExtensionFetch::CREDENTIALS_NONE:
- - if (fetch->url.DomainIs(kGoogleDotCom) && identity_manager_) {
- - fetch->credentials = ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN;
- - } else {
- - fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
- - }
- + fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
- return true;
- case ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN:
- fetch->oauth2_attempt_count++;
- --- a/chrome/browser/extensions/extension_migrator.cc
- +++ b/chrome/browser/extensions/extension_migrator.cc
- @@ -18,7 +18,9 @@ namespace extensions {
- ExtensionMigrator::ExtensionMigrator(Profile* profile,
- const std::string& old_id,
- const std::string& new_id)
- - : profile_(profile), old_id_(old_id), new_id_(new_id) {}
- + : profile_(profile), old_id_(old_id), new_id_(new_id) {
- + chrome_blank_ = GURL("chrome://blank/");
- +}
-
- ExtensionMigrator::~ExtensionMigrator() {
- }
- @@ -31,7 +33,7 @@ void ExtensionMigrator::StartLoading() {
- if (should_have_extension) {
- std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
- entry->SetKey(ExternalProviderImpl::kExternalUpdateUrl,
- - base::Value(extension_urls::GetWebstoreUpdateUrl().spec()));
- + base::Value(chrome_blank_.spec()));
-
- prefs->SetWithoutPathExpansion(new_id_, std::move(entry));
- }
- --- a/chrome/browser/extensions/extension_migrator.h
- +++ b/chrome/browser/extensions/extension_migrator.h
- @@ -9,6 +9,7 @@
-
- #include "base/macros.h"
- #include "chrome/browser/extensions/external_loader.h"
- +#include "url/gurl.h"
-
- class Profile;
-
- @@ -37,6 +38,7 @@ class ExtensionMigrator : public Externa
- Profile* profile_;
- const std::string old_id_;
- const std::string new_id_;
- + GURL chrome_blank_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionMigrator);
- };
|