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

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

Issue 11669012: Convert ProtocolHandlerRegistry::Interceptor to a net::URLRequestJobFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address jhawkins' comments Created 7 years, 11 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/prefs/public/pref_member.h" 16 #include "base/prefs/public/pref_member.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
18 #include "chrome/browser/io_thread.h" 19 #include "chrome/browser/io_thread.h"
19 #include "chrome/browser/net/chrome_url_request_context.h" 20 #include "chrome/browser/net/chrome_url_request_context.h"
20 #include "chrome/browser/profiles/storage_partition_descriptor.h" 21 #include "chrome/browser/profiles/storage_partition_descriptor.h"
21 #include "content/public/browser/resource_context.h" 22 #include "content/public/browser/resource_context.h"
22 #include "net/cookies/cookie_monster.h" 23 #include "net/cookies/cookie_monster.h"
23 #include "net/http/http_network_session.h" 24 #include "net/http/http_network_session.h"
24 #include "net/url_request/url_request_job_factory.h" 25 #include "net/url_request/url_request_job_factory.h"
25 26
26 class ChromeHttpUserAgentSettings; 27 class ChromeHttpUserAgentSettings;
27 class ChromeNetworkDelegate; 28 class ChromeNetworkDelegate;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 // These should only be called at most once each. Ownership is reversed when 83 // These should only be called at most once each. Ownership is reversed when
83 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice 84 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice
84 // versa. 85 // versa.
85 ChromeURLRequestContext* GetMainRequestContext() const; 86 ChromeURLRequestContext* GetMainRequestContext() const;
86 ChromeURLRequestContext* GetMediaRequestContext() const; 87 ChromeURLRequestContext* GetMediaRequestContext() const;
87 ChromeURLRequestContext* GetExtensionsRequestContext() const; 88 ChromeURLRequestContext* GetExtensionsRequestContext() const;
88 ChromeURLRequestContext* GetIsolatedAppRequestContext( 89 ChromeURLRequestContext* GetIsolatedAppRequestContext(
89 ChromeURLRequestContext* main_context, 90 ChromeURLRequestContext* main_context,
90 const StoragePartitionDescriptor& partition_descriptor, 91 const StoragePartitionDescriptor& partition_descriptor,
91 scoped_ptr<net::URLRequestJobFactory::Interceptor> 92 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
92 protocol_handler_interceptor) const; 93 protocol_handler_interceptor) const;
93 ChromeURLRequestContext* GetIsolatedMediaRequestContext( 94 ChromeURLRequestContext* GetIsolatedMediaRequestContext(
94 ChromeURLRequestContext* app_context, 95 ChromeURLRequestContext* app_context,
95 const StoragePartitionDescriptor& partition_descriptor) const; 96 const StoragePartitionDescriptor& partition_descriptor) const;
96 97
97 // These are useful when the Chrome layer is called from the content layer 98 // These are useful when the Chrome layer is called from the content layer
98 // with a content::ResourceContext, and they want access to Chrome data for 99 // with a content::ResourceContext, and they want access to Chrome data for
99 // that profile. 100 // that profile.
100 ExtensionInfoMap* GetExtensionInfoMap() const; 101 ExtensionInfoMap* GetExtensionInfoMap() const;
101 CookieSettings* GetCookieSettings() const; 102 CookieSettings* GetCookieSettings() const;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 scoped_refptr<net::SSLConfigService> ssl_config_service; 212 scoped_refptr<net::SSLConfigService> ssl_config_service;
212 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate; 213 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate;
213 scoped_refptr<ExtensionInfoMap> extension_info_map; 214 scoped_refptr<ExtensionInfoMap> extension_info_map;
214 scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver> 215 scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
215 resource_prefetch_predictor_observer_; 216 resource_prefetch_predictor_observer_;
216 217
217 #if defined(ENABLE_NOTIFICATIONS) 218 #if defined(ENABLE_NOTIFICATIONS)
218 DesktopNotificationService* notification_service; 219 DesktopNotificationService* notification_service;
219 #endif 220 #endif
220 221
221 // This pointer exists only as a means of conveying a url interceptor 222 // This pointer exists only as a means of conveying a url job factory
222 // pointer from the protocol handler registry on the UI thread to the 223 // pointer from the protocol handler registry on the UI thread to the
223 // the URLRequestJobFactory on the IO thread. The consumer MUST take 224 // the URLRequestContext on the IO thread. The consumer MUST take
224 // ownership of the object by calling release() on this pointer. 225 // ownership of the object by calling release() on this pointer.
225 scoped_ptr<net::URLRequestJobFactory::Interceptor> 226 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
226 protocol_handler_interceptor; 227 protocol_handler_interceptor;
227 228
228 // We need to initialize the ProxyConfigService from the UI thread 229 // We need to initialize the ProxyConfigService from the UI thread
229 // because on linux it relies on initializing things through gconf, 230 // because on linux it relies on initializing things through gconf,
230 // and needs to be on the main thread. 231 // and needs to be on the main thread.
231 scoped_ptr<net::ProxyConfigService> proxy_config_service; 232 scoped_ptr<net::ProxyConfigService> proxy_config_service;
232 // The profile this struct was populated from. It's passed as a void* to 233 // The profile this struct was populated from. It's passed as a void* to
233 // ensure it's not accidently used on the IO thread. Before using it on the 234 // ensure it's not accidently used on the IO thread. Before using it on the
234 // UI thread, call ProfileManager::IsValidProfile to ensure it's alive. 235 // UI thread, call ProfileManager::IsValidProfile to ensure it's alive.
235 void* profile; 236 void* profile;
236 }; 237 };
237 238
238 explicit ProfileIOData(bool is_incognito); 239 explicit ProfileIOData(bool is_incognito);
239 240
240 static std::string GetSSLSessionCacheShard(); 241 static std::string GetSSLSessionCacheShard();
241 242
242 void InitializeOnUIThread(Profile* profile); 243 void InitializeOnUIThread(Profile* profile);
243 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; 244 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const;
244 245
245 void SetUpJobFactoryDefaults( 246 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults(
246 net::URLRequestJobFactoryImpl* job_factory, 247 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
247 scoped_ptr<net::URLRequestJobFactory::Interceptor> 248 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
248 protocol_handler_interceptor, 249 protocol_handler_interceptor,
249 net::NetworkDelegate* network_delegate, 250 net::NetworkDelegate* network_delegate,
250 net::FtpTransactionFactory* ftp_transaction_factory, 251 net::FtpTransactionFactory* ftp_transaction_factory,
251 net::FtpAuthCache* ftp_auth_cache) const; 252 net::FtpAuthCache* ftp_auth_cache) const;
252 253
253 // Lazy initializes the ProfileIOData object the first time a request context 254 // Lazy initializes the ProfileIOData object the first time a request context
254 // is requested. The lazy logic is implemented here. The actual initialization 255 // is requested. The lazy logic is implemented here. The actual initialization
255 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper 256 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper
256 // functions have been provided to assist in common operations. 257 // functions have been provided to assist in common operations.
257 void LazyInitialize() const; 258 void LazyInitialize() const;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; 346 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0;
346 347
347 // Initializes the RequestContext for extensions. 348 // Initializes the RequestContext for extensions.
348 virtual void InitializeExtensionsRequestContext( 349 virtual void InitializeExtensionsRequestContext(
349 ProfileParams* profile_params) const = 0; 350 ProfileParams* profile_params) const = 0;
350 // Does an on-demand initialization of a RequestContext for the given 351 // Does an on-demand initialization of a RequestContext for the given
351 // isolated app. 352 // isolated app.
352 virtual ChromeURLRequestContext* InitializeAppRequestContext( 353 virtual ChromeURLRequestContext* InitializeAppRequestContext(
353 ChromeURLRequestContext* main_context, 354 ChromeURLRequestContext* main_context,
354 const StoragePartitionDescriptor& details, 355 const StoragePartitionDescriptor& details,
355 scoped_ptr<net::URLRequestJobFactory::Interceptor> 356 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
356 protocol_handler_interceptor) const = 0; 357 protocol_handler_interceptor) const = 0;
357 358
358 // Does an on-demand initialization of a media RequestContext for the given 359 // Does an on-demand initialization of a media RequestContext for the given
359 // isolated app. 360 // isolated app.
360 virtual ChromeURLRequestContext* InitializeMediaRequestContext( 361 virtual ChromeURLRequestContext* InitializeMediaRequestContext(
361 ChromeURLRequestContext* original_context, 362 ChromeURLRequestContext* original_context,
362 const StoragePartitionDescriptor& details) const = 0; 363 const StoragePartitionDescriptor& details) const = 0;
363 364
364 // These functions are used to transfer ownership of the lazily initialized 365 // These functions are used to transfer ownership of the lazily initialized
365 // context from ProfileIOData to the URLRequestContextGetter. 366 // context from ProfileIOData to the URLRequestContextGetter.
366 virtual ChromeURLRequestContext* 367 virtual ChromeURLRequestContext*
367 AcquireMediaRequestContext() const = 0; 368 AcquireMediaRequestContext() const = 0;
368 virtual ChromeURLRequestContext* 369 virtual ChromeURLRequestContext*
369 AcquireIsolatedAppRequestContext( 370 AcquireIsolatedAppRequestContext(
370 ChromeURLRequestContext* main_context, 371 ChromeURLRequestContext* main_context,
371 const StoragePartitionDescriptor& partition_descriptor, 372 const StoragePartitionDescriptor& partition_descriptor,
372 scoped_ptr<net::URLRequestJobFactory::Interceptor> 373 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
373 protocol_handler_interceptor) const = 0; 374 protocol_handler_interceptor) const = 0;
374 virtual ChromeURLRequestContext* 375 virtual ChromeURLRequestContext*
375 AcquireIsolatedMediaRequestContext( 376 AcquireIsolatedMediaRequestContext(
376 ChromeURLRequestContext* app_context, 377 ChromeURLRequestContext* app_context,
377 const StoragePartitionDescriptor& partition_descriptor) const = 0; 378 const StoragePartitionDescriptor& partition_descriptor) const = 0;
378 379
379 // Returns the LoadTimeStats object to be used for this profile. 380 // Returns the LoadTimeStats object to be used for this profile.
380 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( 381 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats(
381 IOThread::Globals* io_thread_globals) const = 0; 382 IOThread::Globals* io_thread_globals) const = 0;
382 383
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 472
472 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 473 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
473 bool initialized_on_UI_thread_; 474 bool initialized_on_UI_thread_;
474 475
475 bool is_incognito_; 476 bool is_incognito_;
476 477
477 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 478 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
478 }; 479 };
479 480
480 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 481 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698