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

Side by Side Diff: chrome/browser/profiles/profile_io_data.h

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed macro and InMemory. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "chrome/browser/api/prefs/pref_member.h" 17 #include "chrome/browser/api/prefs/pref_member.h"
18 #include "chrome/browser/io_thread.h" 18 #include "chrome/browser/io_thread.h"
19 #include "chrome/browser/net/chrome_url_request_context.h" 19 #include "chrome/browser/net/chrome_url_request_context.h"
20 #include "chrome/browser/profiles/storage_partition_descriptor.h"
20 #include "content/public/browser/resource_context.h" 21 #include "content/public/browser/resource_context.h"
21 #include "net/cookies/cookie_monster.h" 22 #include "net/cookies/cookie_monster.h"
22 #include "net/http/http_network_session.h" 23 #include "net/http/http_network_session.h"
23 #include "net/url_request/url_request_job_factory.h" 24 #include "net/url_request/url_request_job_factory.h"
24 25
25 class CookieSettings; 26 class CookieSettings;
26 class DesktopNotificationService; 27 class DesktopNotificationService;
27 class ExtensionInfoMap; 28 class ExtensionInfoMap;
28 class HostContentSettingsMap; 29 class HostContentSettingsMap;
29 class Profile; 30 class Profile;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const; 76 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const;
76 77
77 // These should only be called at most once each. Ownership is reversed when 78 // These should only be called at most once each. Ownership is reversed when
78 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice 79 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice
79 // versa. 80 // versa.
80 ChromeURLRequestContext* GetMainRequestContext() const; 81 ChromeURLRequestContext* GetMainRequestContext() const;
81 ChromeURLRequestContext* GetMediaRequestContext() const; 82 ChromeURLRequestContext* GetMediaRequestContext() const;
82 ChromeURLRequestContext* GetExtensionsRequestContext() const; 83 ChromeURLRequestContext* GetExtensionsRequestContext() const;
83 ChromeURLRequestContext* GetIsolatedAppRequestContext( 84 ChromeURLRequestContext* GetIsolatedAppRequestContext(
84 ChromeURLRequestContext* main_context, 85 ChromeURLRequestContext* main_context,
85 const std::string& app_id, 86 const StoragePartitionDescriptor& partition_descriptor,
86 scoped_ptr<net::URLRequestJobFactory::Interceptor> 87 scoped_ptr<net::URLRequestJobFactory::Interceptor>
87 protocol_handler_interceptor) const; 88 protocol_handler_interceptor) const;
88 ChromeURLRequestContext* GetIsolatedMediaRequestContext( 89 ChromeURLRequestContext* GetIsolatedMediaRequestContext(
89 ChromeURLRequestContext* app_context, 90 ChromeURLRequestContext* app_context,
90 const std::string& app_id) const; 91 const StoragePartitionDescriptor& partition_descriptor) const;
91 92
92 // These are useful when the Chrome layer is called from the content layer 93 // These are useful when the Chrome layer is called from the content layer
93 // with a content::ResourceContext, and they want access to Chrome data for 94 // with a content::ResourceContext, and they want access to Chrome data for
94 // that profile. 95 // that profile.
95 ExtensionInfoMap* GetExtensionInfoMap() const; 96 ExtensionInfoMap* GetExtensionInfoMap() const;
96 CookieSettings* GetCookieSettings() const; 97 CookieSettings* GetCookieSettings() const;
97 98
98 #if defined(ENABLE_NOTIFICATIONS) 99 #if defined(ENABLE_NOTIFICATIONS)
99 DesktopNotificationService* GetNotificationService() const; 100 DesktopNotificationService* GetNotificationService() const;
100 #endif 101 #endif
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 friend class ProfileIOData; 300 friend class ProfileIOData;
300 301
301 void EnsureInitialized(); 302 void EnsureInitialized();
302 303
303 ProfileIOData* const io_data_; 304 ProfileIOData* const io_data_;
304 305
305 net::HostResolver* host_resolver_; 306 net::HostResolver* host_resolver_;
306 net::URLRequestContext* request_context_; 307 net::URLRequestContext* request_context_;
307 }; 308 };
308 309
309 typedef base::hash_map<std::string, ChromeURLRequestContext*> 310 DefineStoragePartitionDescriptorMap(ChromeURLRequestContext*)
310 URLRequestContextMap; 311 URLRequestContextMap;
311 312
312 // -------------------------------------------- 313 // --------------------------------------------
313 // Virtual interface for subtypes to implement: 314 // Virtual interface for subtypes to implement:
314 // -------------------------------------------- 315 // --------------------------------------------
315 316
316 // Does the actual initialization of the ProfileIOData subtype. Subtypes 317 // Does the actual initialization of the ProfileIOData subtype. Subtypes
317 // should use the static helper functions above to implement this. 318 // should use the static helper functions above to implement this.
318 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; 319 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0;
319 320
320 // Does an on-demand initialization of a RequestContext for the given 321 // Does an on-demand initialization of a RequestContext for the given
321 // isolated app. 322 // isolated app.
322 virtual ChromeURLRequestContext* InitializeAppRequestContext( 323 virtual ChromeURLRequestContext* InitializeAppRequestContext(
323 ChromeURLRequestContext* main_context, 324 ChromeURLRequestContext* main_context,
324 const std::string& app_id, 325 const StoragePartitionDescriptor& details,
325 scoped_ptr<net::URLRequestJobFactory::Interceptor> 326 scoped_ptr<net::URLRequestJobFactory::Interceptor>
326 protocol_handler_interceptor) const = 0; 327 protocol_handler_interceptor) const = 0;
327 328
328 // Does an on-demand initialization of a media RequestContext for the given 329 // Does an on-demand initialization of a media RequestContext for the given
329 // isolated app. 330 // isolated app.
330 virtual ChromeURLRequestContext* InitializeMediaRequestContext( 331 virtual ChromeURLRequestContext* InitializeMediaRequestContext(
331 ChromeURLRequestContext* original_context, 332 ChromeURLRequestContext* original_context,
332 const std::string& app_id) const = 0; 333 const StoragePartitionDescriptor& details) const = 0;
333 334
334 // These functions are used to transfer ownership of the lazily initialized 335 // These functions are used to transfer ownership of the lazily initialized
335 // context from ProfileIOData to the URLRequestContextGetter. 336 // context from ProfileIOData to the URLRequestContextGetter.
336 virtual ChromeURLRequestContext* 337 virtual ChromeURLRequestContext*
337 AcquireMediaRequestContext() const = 0; 338 AcquireMediaRequestContext() const = 0;
338 virtual ChromeURLRequestContext* 339 virtual ChromeURLRequestContext*
339 AcquireIsolatedAppRequestContext( 340 AcquireIsolatedAppRequestContext(
340 ChromeURLRequestContext* main_context, 341 ChromeURLRequestContext* main_context,
341 const std::string& app_id, 342 const StoragePartitionDescriptor& partition_descriptor,
342 scoped_ptr<net::URLRequestJobFactory::Interceptor> 343 scoped_ptr<net::URLRequestJobFactory::Interceptor>
343 protocol_handler_interceptor) const = 0; 344 protocol_handler_interceptor) const = 0;
344 virtual ChromeURLRequestContext* 345 virtual ChromeURLRequestContext*
345 AcquireIsolatedMediaRequestContext( 346 AcquireIsolatedMediaRequestContext(
346 ChromeURLRequestContext* app_context, 347 ChromeURLRequestContext* app_context,
347 const std::string& app_id) const = 0; 348 const StoragePartitionDescriptor& partition_descriptor) const = 0;
348 349
349 // Returns the LoadTimeStats object to be used for this profile. 350 // Returns the LoadTimeStats object to be used for this profile.
350 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( 351 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats(
351 IOThread::Globals* io_thread_globals) const = 0; 352 IOThread::Globals* io_thread_globals) const = 0;
352 353
353 // The order *DOES* matter for the majority of these member variables, so 354 // The order *DOES* matter for the majority of these member variables, so
354 // don't move them around unless you know what you're doing! 355 // don't move them around unless you know what you're doing!
355 // General rules: 356 // General rules:
356 // * ResourceContext references the URLRequestContexts, so 357 // * ResourceContext references the URLRequestContexts, so
357 // URLRequestContexts must outlive ResourceContext, hence ResourceContext 358 // URLRequestContexts must outlive ResourceContext, hence ResourceContext
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 430
430 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 431 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
431 bool initialized_on_UI_thread_; 432 bool initialized_on_UI_thread_;
432 433
433 bool is_incognito_; 434 bool is_incognito_;
434 435
435 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 436 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
436 }; 437 };
437 438
438 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 439 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698