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..fc320455fb923a8094b49ab2a69d3d7d3abfd86f 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: |
| + // Whether or not Incognito-mode is on for the browser window that owns a |
| + // ChromeNetworkDelegate. This determines if we are permitted to transmit |
|
battre
2012/04/23 10:49:55
This comment is not quite accurate: a) you cannot
SteveT
2012/04/27 00:05:07
All of this has been removed.
|
| + // certain bits of information or not. |
| + enum IncognitoState { |
| + INCOGNITO_ON, |
| + INCOGNITO_OFF, |
| + }; |
| + |
| // 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); |
| + IncognitoState incognito_state, |
| + 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 Incognito state of the browser window that uses this delegate. Note |
|
battre
2012/04/23 10:49:55
see above regarding "the browser window"
SteveT
2012/04/27 00:05:07
All of this has been removed.
|
| + // that this field is not valid if |profile_| is NULL, so always check |
| + // profile_ first before this field. |
| + IncognitoState incognito_state_; |
| + |
| 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); |