Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 18 #include "chrome/browser/extensions/extension_protocols.h" | 18 #include "chrome/browser/extensions/extension_protocols.h" |
| 19 #include "chrome/browser/extensions/user_script_master.h" | 19 #include "chrome/browser/extensions/user_script_master.h" |
| 20 #include "chrome/browser/io_thread.h" | 20 #include "chrome/browser/io_thread.h" |
| 21 #include "chrome/browser/net/blob_url_request_job_factory.h" | |
| 22 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 21 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 23 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
| 24 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
| 25 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
| 26 #include "chrome/browser/net/file_system_url_request_job_factory.h" | |
| 27 #include "chrome/browser/net/metadata_url_request.h" | 25 #include "chrome/browser/net/metadata_url_request.h" |
| 28 #include "chrome/browser/net/pref_proxy_config_service.h" | 26 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 29 #include "chrome/browser/net/proxy_service_factory.h" | 27 #include "chrome/browser/net/proxy_service_factory.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/browser/prerender/prerender_manager.h" | 29 #include "chrome/browser/prerender/prerender_manager.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 31 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 34 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 37 #include "content/browser/browser_thread.h" | 35 #include "content/browser/browser_thread.h" |
| 38 #include "content/browser/host_zoom_map.h" | 36 #include "content/browser/host_zoom_map.h" |
| 37 #include "content/browser/renderer_host/resource_dispatcher_host.h" | |
| 38 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | |
| 39 #include "content/browser/resource_context.h" | 39 #include "content/browser/resource_context.h" |
| 40 #include "content/common/notification_service.h" | 40 #include "content/common/notification_service.h" |
| 41 #include "net/http/http_util.h" | 41 #include "net/http/http_util.h" |
| 42 #include "net/proxy/proxy_config_service_fixed.h" | 42 #include "net/proxy/proxy_config_service_fixed.h" |
| 43 #include "net/proxy/proxy_script_fetcher_impl.h" | 43 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 44 #include "net/proxy/proxy_service.h" | 44 #include "net/proxy/proxy_service.h" |
| 45 #include "net/url_request/url_request.h" | 45 #include "net/url_request/url_request.h" |
| 46 #include "webkit/blob/blob_data.h" | |
| 47 #include "webkit/blob/blob_url_request_job_factory.h" | |
| 48 #include "webkit/fileapi/file_system_url_request_job_factory.h" | |
| 46 #include "webkit/database/database_tracker.h" | 49 #include "webkit/database/database_tracker.h" |
| 47 #include "webkit/quota/quota_manager.h" | 50 #include "webkit/quota/quota_manager.h" |
| 48 | 51 |
| 49 namespace { | 52 namespace { |
| 50 | 53 |
| 51 // ---------------------------------------------------------------------------- | 54 // ---------------------------------------------------------------------------- |
| 52 // CookieMonster::Delegate implementation | 55 // CookieMonster::Delegate implementation |
| 53 // ---------------------------------------------------------------------------- | 56 // ---------------------------------------------------------------------------- |
| 54 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { | 57 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { |
| 55 public: | 58 public: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 net::URLRequest* request) const OVERRIDE { | 164 net::URLRequest* request) const OVERRIDE { |
| 162 return NULL; | 165 return NULL; |
| 163 } | 166 } |
| 164 | 167 |
| 165 private: | 168 private: |
| 166 const scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 169 const scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
| 167 | 170 |
| 168 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistryInterceptor); | 171 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistryInterceptor); |
| 169 }; | 172 }; |
| 170 | 173 |
| 174 class ChromeBlobProtocolHandler : public webkit_blob::BlobProtocolHandler { | |
| 175 public: | |
| 176 ChromeBlobProtocolHandler( | |
| 177 webkit_blob::BlobStorageController* blob_storage_controller, | |
| 178 base::MessageLoopProxy* loop_proxy) | |
| 179 : webkit_blob::BlobProtocolHandler(blob_storage_controller, | |
| 180 loop_proxy) {} | |
| 181 | |
| 182 virtual ~ChromeBlobProtocolHandler() {} | |
| 183 | |
| 184 private: | |
| 185 virtual scoped_refptr<webkit_blob::BlobData> | |
| 186 LookupBlobData(net::URLRequest* request) const { | |
| 187 ResourceDispatcherHostRequestInfo* info = | |
| 188 ResourceDispatcherHost::InfoForRequest(request); | |
| 189 if (!info) | |
| 190 return NULL; | |
| 191 return info->requested_blob_data(); | |
| 192 } | |
| 193 | |
| 194 DISALLOW_COPY_AND_ASSIGN(ChromeBlobProtocolHandler); | |
| 195 }; | |
| 196 | |
| 171 } // namespace | 197 } // namespace |
| 172 | 198 |
| 173 void ProfileIOData::InitializeProfileParams(Profile* profile) { | 199 void ProfileIOData::InitializeProfileParams(Profile* profile) { |
| 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 175 PrefService* pref_service = profile->GetPrefs(); | 201 PrefService* pref_service = profile->GetPrefs(); |
| 176 | 202 |
| 177 scoped_ptr<ProfileParams> params(new ProfileParams); | 203 scoped_ptr<ProfileParams> params(new ProfileParams); |
| 178 params->is_incognito = profile->IsOffTheRecord(); | 204 params->is_incognito = profile->IsOffTheRecord(); |
| 179 params->clear_local_state_on_exit = | 205 params->clear_local_state_on_exit = |
| 180 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); | 206 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 DCHECK(set_protocol); | 434 DCHECK(set_protocol); |
| 409 set_protocol = job_factory_->SetProtocolHandler( | 435 set_protocol = job_factory_->SetProtocolHandler( |
| 410 chrome::kChromeDevToolsScheme, | 436 chrome::kChromeDevToolsScheme, |
| 411 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get())); | 437 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get())); |
| 412 #if defined(OS_CHROMEOS) | 438 #if defined(OS_CHROMEOS) |
| 413 set_protocol = job_factory_->SetProtocolHandler( | 439 set_protocol = job_factory_->SetProtocolHandler( |
| 414 chrome::kMetadataScheme, | 440 chrome::kMetadataScheme, |
| 415 CreateMetadataProtocolHandler()); | 441 CreateMetadataProtocolHandler()); |
| 416 #endif // defined(OS_CHROMEOS) | 442 #endif // defined(OS_CHROMEOS) |
| 417 DCHECK(set_protocol); | 443 DCHECK(set_protocol); |
| 418 set_protocol = job_factory_->SetProtocolHandler( | 444 set_protocol = job_factory_->SetProtocolHandler( |
|
michaeln
2011/05/18 01:13:11
I'm not familiar with the per-profile job_factory_
willchan no longer on Chromium
2011/05/18 16:17:01
Yes.
| |
| 419 chrome::kBlobScheme, | 445 chrome::kBlobScheme, |
| 420 CreateBlobProtocolHandler( | 446 new ChromeBlobProtocolHandler( |
| 421 profile_params_->blob_storage_context->controller())); | 447 profile_params_->blob_storage_context->controller(), |
| 448 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | |
| 422 DCHECK(set_protocol); | 449 DCHECK(set_protocol); |
| 423 set_protocol = job_factory_->SetProtocolHandler( | 450 set_protocol = job_factory_->SetProtocolHandler( |
| 424 chrome::kFileSystemScheme, | 451 chrome::kFileSystemScheme, |
| 425 CreateFileSystemProtocolHandler( | 452 CreateFileSystemProtocolHandler( |
| 426 profile_params_->file_system_context)); | 453 profile_params_->file_system_context, |
| 454 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | |
| 427 DCHECK(set_protocol); | 455 DCHECK(set_protocol); |
| 428 | 456 |
| 429 // Take ownership over these parameters. | 457 // Take ownership over these parameters. |
| 430 database_tracker_ = profile_params_->database_tracker; | 458 database_tracker_ = profile_params_->database_tracker; |
| 431 appcache_service_ = profile_params_->appcache_service; | 459 appcache_service_ = profile_params_->appcache_service; |
| 432 blob_storage_context_ = profile_params_->blob_storage_context; | 460 blob_storage_context_ = profile_params_->blob_storage_context; |
| 433 file_system_context_ = profile_params_->file_system_context; | 461 file_system_context_ = profile_params_->file_system_context; |
| 434 quota_manager_ = profile_params_->quota_manager; | 462 quota_manager_ = profile_params_->quota_manager; |
| 435 host_zoom_map_ = profile_params_->host_zoom_map; | 463 host_zoom_map_ = profile_params_->host_zoom_map; |
| 436 host_content_settings_map_ = profile_params_->host_content_settings_map; | 464 host_content_settings_map_ = profile_params_->host_content_settings_map; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 context->set_appcache_service(profile_params_->appcache_service); | 496 context->set_appcache_service(profile_params_->appcache_service); |
| 469 context->set_blob_storage_context(profile_params_->blob_storage_context); | 497 context->set_blob_storage_context(profile_params_->blob_storage_context); |
| 470 context->set_file_system_context(profile_params_->file_system_context); | 498 context->set_file_system_context(profile_params_->file_system_context); |
| 471 context->set_extension_info_map(profile_params_->extension_info_map); | 499 context->set_extension_info_map(profile_params_->extension_info_map); |
| 472 } | 500 } |
| 473 | 501 |
| 474 void ProfileIOData::ShutdownOnUIThread() { | 502 void ProfileIOData::ShutdownOnUIThread() { |
| 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 503 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 476 enable_referrers_.Destroy(); | 504 enable_referrers_.Destroy(); |
| 477 } | 505 } |
| OLD | NEW |