Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: extensions/browser/updater/extension_downloader.cc

Issue 1897293005: Rate limit programmatic update checks for extensions (reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: have Get() just return the net::BackoffEntry::Policy directly Created 4 years, 8 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
Index: extensions/browser/updater/extension_downloader.cc
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc
index 116ef7abb1561000f78029f313f49510d8e086ab..6d94e8697669dd7efce8de52c0c1ae94a6359cf8 100644
--- a/extensions/browser/updater/extension_downloader.cc
+++ b/extensions/browser/updater/extension_downloader.cc
@@ -27,6 +27,7 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/updater/extension_cache.h"
+#include "extensions/browser/updater/extension_downloader_test_delegate.h"
#include "extensions/browser/updater/request_queue_impl.h"
#include "extensions/browser/updater/safe_manifest_parser.h"
#include "extensions/common/extension_urls.h"
@@ -90,6 +91,8 @@ const char kTokenServiceConsumerId[] = "extension_downloader";
const char kWebstoreOAuth2Scope[] =
"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", \
@@ -278,6 +281,12 @@ void ExtensionDownloader::SetWebstoreIdentityProvider(
identity_provider_.swap(identity_provider);
}
+// static
+void ExtensionDownloader::set_test_delegate(
+ ExtensionDownloaderTestDelegate* delegate) {
+ g_test_delegate = delegate;
+}
+
bool ExtensionDownloader::AddExtensionData(const std::string& id,
const Version& version,
Manifest::Type extension_type,
@@ -405,6 +414,11 @@ void ExtensionDownloader::ReportStats() const {
void ExtensionDownloader::StartUpdateCheck(
scoped_ptr<ManifestFetchData> fetch_data) {
+ if (g_test_delegate) {
+ g_test_delegate->StartUpdateCheck(this, delegate_, std::move(fetch_data));
+ return;
+ }
+
const std::set<std::string>& id_set(fetch_data->extension_ids());
if (!ExtensionsBrowserClient::Get()->IsBackgroundUpdateAllowed()) {
« no previous file with comments | « extensions/browser/updater/extension_downloader.h ('k') | extensions/browser/updater/extension_downloader_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698