Chromium Code Reviews| Index: chrome/browser/net/chrome_network_delegate.h |
| diff --git a/chrome/browser/net/chrome_network_delegate.h b/chrome/browser/net/chrome_network_delegate.h |
| index a582c388f1dfee223c44229f80cc69d40481944c..0bfc634b576ab5d26481c5a7fdf74037b8b27deb 100644 |
| --- a/chrome/browser/net/chrome_network_delegate.h |
| +++ b/chrome/browser/net/chrome_network_delegate.h |
| @@ -27,26 +27,45 @@ class URLBlacklistManager; |
| // add hooks into the network stack. |
| class ChromeNetworkDelegate : public net::NetworkDelegate { |
| public: |
| + // The level of visibility of the browser window using this delegate. This |
| + // determines if we are permitted to transmit certain bits of information or |
| + // not. |
| + enum BrowserVisibility { |
| + NORMAL, |
| + INCOGNITO, |
|
Ilya Sherman
2012/04/19 18:52:59
nit: I know it makes for longer lines, but perhaps
SteveT
2012/04/20 16:50:32
Okay, okay. Done :)
|
| + }; |
| + |
| // If |profile| is NULL, events will be broadcasted to all profiles, |
| // otherwise they will only be sent to the specified profile. |
| - // |enable_referrers| should be initialized on the UI thread (see below) |
| - // beforehand. This object's owner is responsible for cleaning it up at |
| - // shutdown. If |cookie_settings| is NULL, all cookies are enabled, |
| - // otherwise, the settings are enforced on all observed network requests. |
| + // |enable_referrers| and |enable_metrics| should be initialized on the UI |
| + // thread (see below) beforehand, though |enable_metrics| is optional and |
| + // will be treated as false if not passed in. This object's owner is |
| + // responsible for cleaning it up at shutdown. If |cookie_settings| is NULL, |
| + // all cookies are enabled, otherwise, the settings are enforced on all |
| + // observed network requests. |
| ChromeNetworkDelegate( |
| ExtensionEventRouterForwarder* event_router, |
| ExtensionInfoMap* extension_info_map, |
| const policy::URLBlacklistManager* url_blacklist_manager, |
| void* profile, |
| CookieSettings* cookie_settings, |
| - BooleanPrefMember* enable_referrers); |
| + BrowserVisibility visibility, |
| + BooleanPrefMember* enable_referrers, |
| + BooleanPrefMember* enable_metrics); |
| virtual ~ChromeNetworkDelegate(); |
| - // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. |
| - // This method should be called on the UI thread. |
| + // Binds |enable_referrers| to the kReferrersEnabled pref in |pref_service| |
| + // and moves it to the IO thread. This method should be called on the UI |
| + // thread. |
| static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers, |
| PrefService* pref_service); |
| + // Binds |enable_referrers| to the kMetricsReportingEnabled pref in |
| + // |pref_service| and moves it to the IO thread. This method should be called |
| + // on the UI thread. |
| + static void InitializeMetricsEnabled(BooleanPrefMember* enable_metrics, |
| + PrefService* pref_service); |
| + |
| private: |
| // NetworkDelegate implementation. |
| virtual int OnBeforeURLRequest(net::URLRequest* request, |
| @@ -83,16 +102,29 @@ class ChromeNetworkDelegate : public net::NetworkDelegate { |
| const std::string& cookie_line, |
| net::CookieOptions* options) OVERRIDE; |
| + // Adds Chrome experiment and metrics state as custom headers to |headers| |
| + // based on local state and |request|. |
| + void AddChromeMetricsStateHeader(net::URLRequest* request, |
| + net::HttpRequestHeaders* headers); |
| + |
| scoped_refptr<ExtensionEventRouterForwarder> event_router_; |
| void* profile_; |
| scoped_refptr<CookieSettings> cookie_settings_; |
| + // The visibility of the browser window that uses this delegate. Note that |
| + // this field is not valid if |profile_| is NULL, so always check profile_ |
| + // first before this field. |
| + BrowserVisibility visibility_; |
| + |
| scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| // Weak, owned by our owner. |
| BooleanPrefMember* enable_referrers_; |
| // Weak, owned by our owner. |
| + BooleanPrefMember* enable_metrics_; |
| + |
| + // Weak, owned by our owner. |
| const policy::URLBlacklistManager* url_blacklist_manager_; |
| DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |