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

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: Fixed the order in the gypi file. 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 typedef std::map<StoragePartitionDescriptor,
311 ChromeURLRequestContext*,
312 StoragePartitionDescriptorLess>
310 URLRequestContextMap; 313 URLRequestContextMap;
311 314
312 // -------------------------------------------- 315 // --------------------------------------------
313 // Virtual interface for subtypes to implement: 316 // Virtual interface for subtypes to implement:
314 // -------------------------------------------- 317 // --------------------------------------------
315 318
316 // Does the actual initialization of the ProfileIOData subtype. Subtypes 319 // Does the actual initialization of the ProfileIOData subtype. Subtypes
317 // should use the static helper functions above to implement this. 320 // should use the static helper functions above to implement this.
318 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; 321 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0;
319 322
320 // Does an on-demand initialization of a RequestContext for the given 323 // Does an on-demand initialization of a RequestContext for the given
321 // isolated app. 324 // isolated app.
322 virtual ChromeURLRequestContext* InitializeAppRequestContext( 325 virtual ChromeURLRequestContext* InitializeAppRequestContext(
323 ChromeURLRequestContext* main_context, 326 ChromeURLRequestContext* main_context,
324 const std::string& app_id, 327 const StoragePartitionDescriptor& details,
325 scoped_ptr<net::URLRequestJobFactory::Interceptor> 328 scoped_ptr<net::URLRequestJobFactory::Interceptor>
326 protocol_handler_interceptor) const = 0; 329 protocol_handler_interceptor) const = 0;
327 330
328 // Does an on-demand initialization of a media RequestContext for the given 331 // Does an on-demand initialization of a media RequestContext for the given
329 // isolated app. 332 // isolated app.
330 virtual ChromeURLRequestContext* InitializeMediaRequestContext( 333 virtual ChromeURLRequestContext* InitializeMediaRequestContext(
331 ChromeURLRequestContext* original_context, 334 ChromeURLRequestContext* original_context,
332 const std::string& app_id) const = 0; 335 const StoragePartitionDescriptor& details) const = 0;
333 336
334 // These functions are used to transfer ownership of the lazily initialized 337 // These functions are used to transfer ownership of the lazily initialized
335 // context from ProfileIOData to the URLRequestContextGetter. 338 // context from ProfileIOData to the URLRequestContextGetter.
336 virtual ChromeURLRequestContext* 339 virtual ChromeURLRequestContext*
337 AcquireMediaRequestContext() const = 0; 340 AcquireMediaRequestContext() const = 0;
338 virtual ChromeURLRequestContext* 341 virtual ChromeURLRequestContext*
339 AcquireIsolatedAppRequestContext( 342 AcquireIsolatedAppRequestContext(
340 ChromeURLRequestContext* main_context, 343 ChromeURLRequestContext* main_context,
341 const std::string& app_id, 344 const StoragePartitionDescriptor& partition_descriptor,
342 scoped_ptr<net::URLRequestJobFactory::Interceptor> 345 scoped_ptr<net::URLRequestJobFactory::Interceptor>
343 protocol_handler_interceptor) const = 0; 346 protocol_handler_interceptor) const = 0;
344 virtual ChromeURLRequestContext* 347 virtual ChromeURLRequestContext*
345 AcquireIsolatedMediaRequestContext( 348 AcquireIsolatedMediaRequestContext(
346 ChromeURLRequestContext* app_context, 349 ChromeURLRequestContext* app_context,
347 const std::string& app_id) const = 0; 350 const StoragePartitionDescriptor& partition_descriptor) const = 0;
348 351
349 // Returns the LoadTimeStats object to be used for this profile. 352 // Returns the LoadTimeStats object to be used for this profile.
350 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( 353 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats(
351 IOThread::Globals* io_thread_globals) const = 0; 354 IOThread::Globals* io_thread_globals) const = 0;
352 355
353 // The order *DOES* matter for the majority of these member variables, so 356 // 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! 357 // don't move them around unless you know what you're doing!
355 // General rules: 358 // General rules:
356 // * ResourceContext references the URLRequestContexts, so 359 // * ResourceContext references the URLRequestContexts, so
357 // URLRequestContexts must outlive ResourceContext, hence ResourceContext 360 // URLRequestContexts must outlive ResourceContext, hence ResourceContext
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 432
430 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 433 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
431 bool initialized_on_UI_thread_; 434 bool initialized_on_UI_thread_;
432 435
433 bool is_incognito_; 436 bool is_incognito_;
434 437
435 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 438 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
436 }; 439 };
437 440
438 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 441 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698