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

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: Created 4 years, 4 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: 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..49514d935a72ca1201748e4522dcbc9e8d29d93b 100644
--- a/components/web_resource/web_resource_service.h
+++ b/components/web_resource/web_resource_service.h
@@ -64,10 +64,16 @@ class WebResourceService
// Then begin updating resources.
void StartAfterDelay();
+ // Sets the ResourceRequestAllowedNotifier to make it configurable.
+ void SetResourceRequestAllowedNotifier(
+ std::unique_ptr<ResourceRequestAllowedNotifier> notifier);
Dan Beam 2016/08/08 18:15:33 4\s indent instead of 2\s (add 2 more spaces to th
+
protected:
PrefService* prefs_;
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 +98,14 @@ 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_;

Powered by Google App Engine
This is Rietveld 408576698