OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 class CookieSettings; | 23 class CookieSettings; |
24 class DesktopNotificationService; | 24 class DesktopNotificationService; |
25 class ExtensionInfoMap; | 25 class ExtensionInfoMap; |
26 class HostContentSettingsMap; | 26 class HostContentSettingsMap; |
27 class IOThread; | 27 class IOThread; |
28 class Profile; | 28 class Profile; |
29 class ProtocolHandlerRegistry; | 29 class ProtocolHandlerRegistry; |
30 class TransportSecurityPersister; | 30 class TransportSecurityPersister; |
31 | 31 |
32 namespace chrome_browser_net { | 32 namespace chrome_browser_net { |
33 class CacheStats; | |
33 class HttpServerPropertiesManager; | 34 class HttpServerPropertiesManager; |
34 class ResourcePrefetchPredictorObserver; | 35 class ResourcePrefetchPredictorObserver; |
35 } | 36 } |
36 | 37 |
37 namespace net { | 38 namespace net { |
38 class CookieStore; | 39 class CookieStore; |
39 class FraudulentCertificateReporter; | 40 class FraudulentCertificateReporter; |
40 class HttpTransactionFactory; | 41 class HttpTransactionFactory; |
41 class ServerBoundCertService; | 42 class ServerBoundCertService; |
42 class ProxyConfigService; | 43 class ProxyConfigService; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 void InitializeMetricsEnabledStateOnUIThread(); | 126 void InitializeMetricsEnabledStateOnUIThread(); |
126 | 127 |
127 // Returns whether or not metrics reporting is enabled in the browser instance | 128 // Returns whether or not metrics reporting is enabled in the browser instance |
128 // on which this profile resides. This is safe for use from the IO thread, and | 129 // on which this profile resides. This is safe for use from the IO thread, and |
129 // should only be called from there. | 130 // should only be called from there. |
130 bool GetMetricsEnabledStateOnIOThread() const; | 131 bool GetMetricsEnabledStateOnIOThread() const; |
131 | 132 |
132 protected: | 133 protected: |
133 class AppRequestContext : public ChromeURLRequestContext { | 134 class AppRequestContext : public ChromeURLRequestContext { |
134 public: | 135 public: |
135 AppRequestContext(); | 136 explicit AppRequestContext(chrome_browser_net::CacheStats* cache_stats); |
136 | 137 |
137 void SetCookieStore(net::CookieStore* cookie_store); | 138 void SetCookieStore(net::CookieStore* cookie_store); |
138 void SetHttpTransactionFactory(net::HttpTransactionFactory* http_factory); | 139 void SetHttpTransactionFactory(net::HttpTransactionFactory* http_factory); |
139 | 140 |
140 private: | 141 private: |
141 virtual ~AppRequestContext(); | 142 virtual ~AppRequestContext(); |
142 | 143 |
143 scoped_refptr<net::CookieStore> cookie_store_; | 144 scoped_refptr<net::CookieStore> cookie_store_; |
144 scoped_ptr<net::HttpTransactionFactory> http_factory_; | 145 scoped_ptr<net::HttpTransactionFactory> http_factory_; |
145 }; | 146 }; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 return proxy_service_.get(); | 229 return proxy_service_.get(); |
229 } | 230 } |
230 | 231 |
231 void set_http_server_properties_manager( | 232 void set_http_server_properties_manager( |
232 chrome_browser_net::HttpServerPropertiesManager* manager) const; | 233 chrome_browser_net::HttpServerPropertiesManager* manager) const; |
233 | 234 |
234 ChromeURLRequestContext* main_request_context() const { | 235 ChromeURLRequestContext* main_request_context() const { |
235 return main_request_context_.get(); | 236 return main_request_context_.get(); |
236 } | 237 } |
237 | 238 |
239 chrome_browser_net::CacheStats* cache_stats() const { | |
240 return cache_stats_; | |
241 } | |
242 | |
238 // Destroys the ResourceContext first, to cancel any URLRequests that are | 243 // Destroys the ResourceContext first, to cancel any URLRequests that are |
239 // using it still, before we destroy the member variables that those | 244 // using it still, before we destroy the member variables that those |
240 // URLRequests may be accessing. | 245 // URLRequests may be accessing. |
241 void DestroyResourceContext(); | 246 void DestroyResourceContext(); |
242 | 247 |
243 private: | 248 private: |
244 class ResourceContext : public content::ResourceContext { | 249 class ResourceContext : public content::ResourceContext { |
245 public: | 250 public: |
246 explicit ResourceContext(ProfileIOData* io_data); | 251 explicit ResourceContext(ProfileIOData* io_data); |
247 virtual ~ResourceContext(); | 252 virtual ~ResourceContext(); |
248 | 253 |
249 // ResourceContext implementation: | 254 // ResourceContext implementation: |
250 virtual net::HostResolver* GetHostResolver() OVERRIDE; | 255 virtual net::HostResolver* GetHostResolver() OVERRIDE; |
251 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; | 256 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; |
252 | 257 |
253 private: | 258 private: |
254 friend class ProfileIOData; | 259 friend class ProfileIOData; |
255 | 260 |
256 void EnsureInitialized(); | 261 void EnsureInitialized(); |
257 | 262 |
258 ProfileIOData* const io_data_; | 263 ProfileIOData* const io_data_; |
259 | 264 |
260 net::HostResolver* host_resolver_; | 265 net::HostResolver* host_resolver_; |
261 net::URLRequestContext* request_context_; | 266 net::URLRequestContext* request_context_; |
262 }; | 267 }; |
263 | 268 |
264 typedef base::hash_map<std::string, ChromeURLRequestContext*> | 269 typedef base::hash_map<std::string, ChromeURLRequestContext*> |
265 AppRequestContextMap; | 270 AppRequestContextMap; |
266 | 271 |
272 // Returns the CacheStats object to be used for this profile | |
273 // (may be NULL for OTR profiles). | |
274 virtual chrome_browser_net::CacheStats* GetCacheStats( | |
willchan no longer on Chromium
2012/07/26 20:03:38
Can you move this to the virtual interface section
tburkard
2012/07/26 20:52:31
Done.
| |
275 IOThread* io_thread) const; | |
276 | |
267 // -------------------------------------------- | 277 // -------------------------------------------- |
268 // Virtual interface for subtypes to implement: | 278 // Virtual interface for subtypes to implement: |
269 // -------------------------------------------- | 279 // -------------------------------------------- |
270 | 280 |
271 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 281 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
272 // should use the static helper functions above to implement this. | 282 // should use the static helper functions above to implement this. |
273 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; | 283 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; |
274 | 284 |
275 // Does an on-demand initialization of a RequestContext for the given | 285 // Does an on-demand initialization of a RequestContext for the given |
276 // isolated app. | 286 // isolated app. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 mutable AppRequestContextMap app_request_context_map_; | 362 mutable AppRequestContextMap app_request_context_map_; |
353 | 363 |
354 mutable scoped_ptr<ResourceContext> resource_context_; | 364 mutable scoped_ptr<ResourceContext> resource_context_; |
355 | 365 |
356 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_; | 366 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_; |
357 mutable scoped_refptr<CookieSettings> cookie_settings_; | 367 mutable scoped_refptr<CookieSettings> cookie_settings_; |
358 | 368 |
359 mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver> | 369 mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver> |
360 resource_prefetch_predictor_observer_; | 370 resource_prefetch_predictor_observer_; |
361 | 371 |
372 mutable chrome_browser_net::CacheStats* cache_stats_; | |
373 | |
362 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 374 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
363 bool initialized_on_UI_thread_; | 375 bool initialized_on_UI_thread_; |
364 | 376 |
365 bool is_incognito_; | 377 bool is_incognito_; |
366 | 378 |
367 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 379 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
368 }; | 380 }; |
369 | 381 |
370 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 382 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |