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

Unified Diff: components/web_resource/web_resource_service.h

Issue 2217683002: Allow embedder to use custom ResourceRequestAllowedNotifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow embedder to use custom ResourceRequestAllowedNotifier Created 3 years, 10 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 | « components/web_resource/BUILD.gn ('k') | components/web_resource/web_resource_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/web_resource/web_resource_service.h
diff --git a/components/web_resource/web_resource_service.h b/components/web_resource/web_resource_service.h
index 1c1103ab9510d51eca7d2c52a262903e4c5c0b4e..d29ab053472070ec7f88b9cc297a8f9915ffabc1 100644
--- a/components/web_resource/web_resource_service.h
+++ b/components/web_resource/web_resource_service.h
@@ -64,10 +64,17 @@ class WebResourceService
// Then begin updating resources.
void StartAfterDelay();
+ // Sets the ResourceRequestAllowedNotifier to make it configurable.
+ void SetResourceRequestAllowedNotifier(
+ std::unique_ptr<ResourceRequestAllowedNotifier> notifier);
+
protected:
PrefService* prefs_;
+ bool GetFetchScheduled() const;
private:
+ friend class WebResourceServiceTest;
+
// For the subclasses to process the result of a fetch.
virtual void Unpack(const base::DictionaryValue& parsed_json) = 0;
@@ -92,7 +99,15 @@ class WebResourceService
// Helper class used to tell this service if it's allowed to make network
// resource requests.
- ResourceRequestAllowedNotifier resource_request_allowed_notifier_;
+ std::unique_ptr<ResourceRequestAllowedNotifier>
+ resource_request_allowed_notifier_;
+
+ // True if we have scheduled a fetch after start_fetch_delay_ms_
+ // or another one in |cache_update_delay_ms_| time. Set to false
+ // before fetching starts so that next fetch is scheduled. This
+ // is to make sure not more than one fetch is scheduled for given
+ // point in time.
+ bool fetch_scheduled_;
// The tool that fetches the url data from the server.
std::unique_ptr<net::URLFetcher> url_fetcher_;
« no previous file with comments | « components/web_resource/BUILD.gn ('k') | components/web_resource/web_resource_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698