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

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

Issue 7282054: Remove more unnecessary ChromeURLRequestContext members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add new valgrind sigs Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/task.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/content_settings/host_content_settings_map.h" 17 #include "chrome/browser/content_settings/host_content_settings_map.h"
17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
19 #include "chrome/browser/extensions/extension_info_map.h"
18 #include "chrome/browser/extensions/extension_protocols.h" 20 #include "chrome/browser/extensions/extension_protocols.h"
19 #include "chrome/browser/io_thread.h" 21 #include "chrome/browser/io_thread.h"
20 #include "chrome/browser/media/media_internals.h" 22 #include "chrome/browser/media/media_internals.h"
21 #include "chrome/browser/net/chrome_cookie_notification_details.h" 23 #include "chrome/browser/net/chrome_cookie_notification_details.h"
22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" 24 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h"
23 #include "chrome/browser/net/chrome_net_log.h" 25 #include "chrome/browser/net/chrome_net_log.h"
24 #include "chrome/browser/net/chrome_network_delegate.h" 26 #include "chrome/browser/net/chrome_network_delegate.h"
25 #include "chrome/browser/net/pref_proxy_config_service.h" 27 #include "chrome/browser/net/pref_proxy_config_service.h"
26 #include "chrome/browser/net/proxy_service_factory.h" 28 #include "chrome/browser/net/proxy_service_factory.h"
27 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 29 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
28 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/prerender/prerender_manager.h" 31 #include "chrome/browser/prerender/prerender_manager.h"
30 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 33 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
32 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
34 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "content/browser/appcache/chrome_appcache_service.h"
35 #include "content/browser/browser_thread.h" 38 #include "content/browser/browser_thread.h"
39 #include "content/browser/chrome_blob_storage_context.h"
36 #include "content/browser/host_zoom_map.h" 40 #include "content/browser/host_zoom_map.h"
37 #include "content/browser/renderer_host/resource_dispatcher_host.h" 41 #include "content/browser/renderer_host/resource_dispatcher_host.h"
38 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 42 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
39 #include "content/browser/resource_context.h" 43 #include "content/browser/resource_context.h"
40 #include "content/common/notification_service.h" 44 #include "content/common/notification_service.h"
41 #include "net/http/http_util.h" 45 #include "net/http/http_util.h"
42 #include "net/proxy/proxy_config_service_fixed.h" 46 #include "net/proxy/proxy_config_service_fixed.h"
43 #include "net/proxy/proxy_script_fetcher_impl.h" 47 #include "net/proxy/proxy_script_fetcher_impl.h"
44 #include "net/proxy/proxy_service.h" 48 #include "net/proxy/proxy_service.h"
45 #include "net/url_request/url_request.h" 49 #include "net/url_request/url_request.h"
46 #include "webkit/blob/blob_data.h" 50 #include "webkit/blob/blob_data.h"
47 #include "webkit/blob/blob_url_request_job_factory.h" 51 #include "webkit/blob/blob_url_request_job_factory.h"
52 #include "webkit/fileapi/file_system_context.h"
48 #include "webkit/fileapi/file_system_url_request_job_factory.h" 53 #include "webkit/fileapi/file_system_url_request_job_factory.h"
49 #include "webkit/database/database_tracker.h" 54 #include "webkit/database/database_tracker.h"
50 #include "webkit/quota/quota_manager.h" 55 #include "webkit/quota/quota_manager.h"
51 56
52 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
53 #include "chrome/browser/chromeos/gview_request_interceptor.h" 58 #include "chrome/browser/chromeos/gview_request_interceptor.h"
54 #endif // defined(OS_CHROMEOS) 59 #endif // defined(OS_CHROMEOS)
55 60
56 namespace { 61 namespace {
57 62
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 profile_id(Profile::kInvalidProfileId) {} 280 profile_id(Profile::kInvalidProfileId) {}
276 ProfileIOData::ProfileParams::~ProfileParams() {} 281 ProfileIOData::ProfileParams::~ProfileParams() {}
277 282
278 ProfileIOData::ProfileIOData(bool is_incognito) 283 ProfileIOData::ProfileIOData(bool is_incognito)
279 : initialized_(false), 284 : initialized_(false),
280 ALLOW_THIS_IN_INITIALIZER_LIST(resource_context_(this)) { 285 ALLOW_THIS_IN_INITIALIZER_LIST(resource_context_(this)) {
281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
282 } 287 }
283 288
284 ProfileIOData::~ProfileIOData() { 289 ProfileIOData::~ProfileIOData() {
285 // If we have never initialized ProfileIOData, then Handle may hold the only 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
286 // reference to it. The important thing is to make sure it hasn't been
287 // initialized yet, because the lazily initialized variables are supposed to
288 // live on the IO thread.
289 if (BrowserThread::CurrentlyOn(BrowserThread::UI))
290 DCHECK(!initialized_);
291 else
292 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
293 } 291 }
294 292
295 // static 293 // static
296 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { 294 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
297 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); 295 DCHECK_EQ(scheme, StringToLowerASCII(scheme));
298 static const char* const kProtocolList[] = { 296 static const char* const kProtocolList[] = {
299 chrome::kExtensionScheme, 297 chrome::kExtensionScheme,
300 chrome::kChromeUIScheme, 298 chrome::kChromeUIScheme,
301 chrome::kChromeDevToolsScheme, 299 chrome::kChromeDevToolsScheme,
302 #if defined(OS_CHROMEOS) 300 #if defined(OS_CHROMEOS)
(...skipping 11 matching lines...) Expand all
314 312
315 bool ProfileIOData::IsHandledURL(const GURL& url) { 313 bool ProfileIOData::IsHandledURL(const GURL& url) {
316 if (!url.is_valid()) { 314 if (!url.is_valid()) {
317 // We handle error cases. 315 // We handle error cases.
318 return true; 316 return true;
319 } 317 }
320 318
321 return IsHandledProtocol(url.scheme()); 319 return IsHandledProtocol(url.scheme());
322 } 320 }
323 321
322 const content::ResourceContext& ProfileIOData::GetResourceContext() const {
323 return resource_context_;
324 }
325
326 ChromeURLDataManagerBackend*
327 ProfileIOData::GetChromeURLDataManagerBackend() const {
328 LazyInitialize();
329 return chrome_url_data_manager_backend_.get();
330 }
331
324 scoped_refptr<ChromeURLRequestContext> 332 scoped_refptr<ChromeURLRequestContext>
325 ProfileIOData::GetMainRequestContext() const { 333 ProfileIOData::GetMainRequestContext() const {
326 LazyInitialize(); 334 LazyInitialize();
327 scoped_refptr<RequestContext> context = main_request_context_; 335 scoped_refptr<RequestContext> context = main_request_context_;
328 context->set_profile_io_data(this); 336 context->set_profile_io_data(this);
329 main_request_context_ = NULL; 337 main_request_context_ = NULL;
330 return context; 338 return context;
331 } 339 }
332 340
333 scoped_refptr<ChromeURLRequestContext> 341 scoped_refptr<ChromeURLRequestContext>
(...skipping 19 matching lines...) Expand all
353 ProfileIOData::GetIsolatedAppRequestContext( 361 ProfileIOData::GetIsolatedAppRequestContext(
354 scoped_refptr<ChromeURLRequestContext> main_context, 362 scoped_refptr<ChromeURLRequestContext> main_context,
355 const std::string& app_id) const { 363 const std::string& app_id) const {
356 LazyInitialize(); 364 LazyInitialize();
357 scoped_refptr<ChromeURLRequestContext> context = 365 scoped_refptr<ChromeURLRequestContext> context =
358 AcquireIsolatedAppRequestContext(main_context, app_id); 366 AcquireIsolatedAppRequestContext(main_context, app_id);
359 DCHECK(context); 367 DCHECK(context);
360 return context; 368 return context;
361 } 369 }
362 370
363 const content::ResourceContext& ProfileIOData::GetResourceContext() const {
364 return resource_context_;
365 }
366
367 ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const { 371 ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const {
368 return extension_info_map_; 372 return extension_info_map_;
369 } 373 }
370 374
371 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { 375 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const {
372 return host_content_settings_map_; 376 return host_content_settings_map_;
373 } 377 }
374 378
375 DesktopNotificationService* ProfileIOData::GetNotificationService() const { 379 DesktopNotificationService* ProfileIOData::GetNotificationService() const {
376 return notification_service_; 380 return notification_service_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 437 }
434 bool set_protocol = job_factory_->SetProtocolHandler( 438 bool set_protocol = job_factory_->SetProtocolHandler(
435 chrome::kExtensionScheme, 439 chrome::kExtensionScheme,
436 CreateExtensionProtocolHandler(profile_params_->is_incognito, 440 CreateExtensionProtocolHandler(profile_params_->is_incognito,
437 profile_params_->extension_info_map)); 441 profile_params_->extension_info_map));
438 DCHECK(set_protocol); 442 DCHECK(set_protocol);
439 set_protocol = job_factory_->SetProtocolHandler( 443 set_protocol = job_factory_->SetProtocolHandler(
440 chrome::kChromeUIScheme, 444 chrome::kChromeUIScheme,
441 ChromeURLDataManagerBackend::CreateProtocolHandler( 445 ChromeURLDataManagerBackend::CreateProtocolHandler(
442 chrome_url_data_manager_backend_.get(), 446 chrome_url_data_manager_backend_.get(),
443 profile_params_->appcache_service)); 447 profile_params_->appcache_service,
448 profile_params_->blob_storage_context->controller()));
444 DCHECK(set_protocol); 449 DCHECK(set_protocol);
445 set_protocol = job_factory_->SetProtocolHandler( 450 set_protocol = job_factory_->SetProtocolHandler(
446 chrome::kChromeDevToolsScheme, 451 chrome::kChromeDevToolsScheme,
447 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get())); 452 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get()));
448 DCHECK(set_protocol); 453 DCHECK(set_protocol);
449 set_protocol = job_factory_->SetProtocolHandler( 454 set_protocol = job_factory_->SetProtocolHandler(
450 chrome::kBlobScheme, 455 chrome::kBlobScheme,
451 new ChromeBlobProtocolHandler( 456 new ChromeBlobProtocolHandler(
452 profile_params_->blob_storage_context->controller(), 457 profile_params_->blob_storage_context->controller(),
453 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); 458 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 504
500 void ProfileIOData::ApplyProfileParamsToContext( 505 void ProfileIOData::ApplyProfileParamsToContext(
501 ChromeURLRequestContext* context) const { 506 ChromeURLRequestContext* context) const {
502 context->set_is_incognito(profile_params_->is_incognito); 507 context->set_is_incognito(profile_params_->is_incognito);
503 context->set_accept_language(profile_params_->accept_language); 508 context->set_accept_language(profile_params_->accept_language);
504 context->set_accept_charset(profile_params_->accept_charset); 509 context->set_accept_charset(profile_params_->accept_charset);
505 context->set_referrer_charset(profile_params_->referrer_charset); 510 context->set_referrer_charset(profile_params_->referrer_charset);
506 context->set_transport_security_state( 511 context->set_transport_security_state(
507 profile_params_->transport_security_state); 512 profile_params_->transport_security_state);
508 context->set_ssl_config_service(profile_params_->ssl_config_service); 513 context->set_ssl_config_service(profile_params_->ssl_config_service);
509 context->set_appcache_service(profile_params_->appcache_service);
510 context->set_blob_storage_context(profile_params_->blob_storage_context);
511 context->set_file_system_context(profile_params_->file_system_context);
512 context->set_extension_info_map(profile_params_->extension_info_map);
513 } 514 }
514 515
515 void ProfileIOData::ShutdownOnUIThread() { 516 void ProfileIOData::ShutdownOnUIThread() {
516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 517 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
517 enable_referrers_.Destroy(); 518 enable_referrers_.Destroy();
518 clear_local_state_on_exit_.Destroy(); 519 clear_local_state_on_exit_.Destroy();
520 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
521 new ReleaseTask<ProfileIOData>(this));
519 } 522 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698