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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // URLRequests may be accessing. | 279 // URLRequests may be accessing. |
280 void DestroyResourceContext(); | 280 void DestroyResourceContext(); |
281 | 281 |
282 // Fills in fields of params using values from main_request_context_ and the | 282 // Fills in fields of params using values from main_request_context_ and the |
283 // IOThread associated with profile_params. | 283 // IOThread associated with profile_params. |
284 void PopulateNetworkSessionParams( | 284 void PopulateNetworkSessionParams( |
285 const ProfileParams* profile_params, | 285 const ProfileParams* profile_params, |
286 net::HttpNetworkSession::Params* params) const; | 286 net::HttpNetworkSession::Params* params) const; |
287 | 287 |
288 private: | 288 private: |
| 289 friend class ProfileImplIOData; |
| 290 |
289 class ResourceContext : public content::ResourceContext { | 291 class ResourceContext : public content::ResourceContext { |
290 public: | 292 public: |
291 explicit ResourceContext(ProfileIOData* io_data); | 293 explicit ResourceContext(ProfileIOData* io_data); |
292 virtual ~ResourceContext(); | 294 virtual ~ResourceContext(); |
293 | 295 |
294 // ResourceContext implementation: | 296 // ResourceContext implementation: |
295 virtual net::HostResolver* GetHostResolver() OVERRIDE; | 297 virtual net::HostResolver* GetHostResolver() OVERRIDE; |
296 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; | 298 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; |
297 | 299 |
298 private: | 300 private: |
299 friend class ProfileIOData; | 301 friend class ProfileIOData; |
300 | 302 |
301 void EnsureInitialized(); | 303 void EnsureInitialized(); |
302 | 304 |
303 ProfileIOData* const io_data_; | 305 ProfileIOData* const io_data_; |
304 | 306 |
305 net::HostResolver* host_resolver_; | 307 net::HostResolver* host_resolver_; |
306 net::URLRequestContext* request_context_; | 308 net::URLRequestContext* request_context_; |
307 }; | 309 }; |
308 | 310 |
309 typedef base::hash_map<std::string, ChromeURLRequestContext*> | 311 typedef base::hash_map<std::string, ChromeURLRequestContext*> |
310 URLRequestContextMap; | 312 URLRequestContextMap; |
311 | 313 |
| 314 // Sets up a skeleton instance to be used by TestingProfile in unit tests. |
| 315 // Gets the object into a virtually initialized state, but skips most of the |
| 316 // usual initialization steps, and only creates what is needed for testing. |
| 317 void InitForTesting(); |
| 318 |
312 // -------------------------------------------- | 319 // -------------------------------------------- |
313 // Virtual interface for subtypes to implement: | 320 // Virtual interface for subtypes to implement: |
314 // -------------------------------------------- | 321 // -------------------------------------------- |
315 | 322 |
316 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 323 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
317 // should use the static helper functions above to implement this. | 324 // should use the static helper functions above to implement this. |
318 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; | 325 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; |
319 | 326 |
320 // Does an on-demand initialization of a RequestContext for the given | 327 // Does an on-demand initialization of a RequestContext for the given |
321 // isolated app. | 328 // isolated app. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 436 |
430 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 437 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
431 bool initialized_on_UI_thread_; | 438 bool initialized_on_UI_thread_; |
432 | 439 |
433 bool is_incognito_; | 440 bool is_incognito_; |
434 | 441 |
435 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 442 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
436 }; | 443 }; |
437 | 444 |
438 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 445 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |