| OLD | NEW |
| 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 #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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 #include "net/ssl/client_cert_store_win.h" | 129 #include "net/ssl/client_cert_store_win.h" |
| 130 #endif | 130 #endif |
| 131 | 131 |
| 132 #if defined(OS_MACOSX) | 132 #if defined(OS_MACOSX) |
| 133 #include "net/ssl/client_cert_store_mac.h" | 133 #include "net/ssl/client_cert_store_mac.h" |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 using content::BrowserContext; | 136 using content::BrowserContext; |
| 137 using content::BrowserThread; | 137 using content::BrowserThread; |
| 138 using content::ResourceContext; | 138 using content::ResourceContext; |
| 139 using data_reduction_proxy::DataReductionProxyUsageStats; | |
| 140 | 139 |
| 141 namespace { | 140 namespace { |
| 142 | 141 |
| 143 #if defined(DEBUG_DEVTOOLS) | 142 #if defined(DEBUG_DEVTOOLS) |
| 144 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { | 143 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { |
| 145 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 144 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
| 146 bundled_path_prefix = "/" + bundled_path_prefix + "/"; | 145 bundled_path_prefix = "/" + bundled_path_prefix + "/"; |
| 147 | 146 |
| 148 if (!url.SchemeIs(content::kChromeDevToolsScheme) || | 147 if (!url.SchemeIs(content::kChromeDevToolsScheme) || |
| 149 url.host() != chrome::kChromeUIDevToolsHost || | 148 url.host() != chrome::kChromeUIDevToolsHost || |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 479 } |
| 481 } | 480 } |
| 482 #endif | 481 #endif |
| 483 | 482 |
| 484 incognito_availibility_pref_.Init( | 483 incognito_availibility_pref_.Init( |
| 485 prefs::kIncognitoModeAvailability, pref_service); | 484 prefs::kIncognitoModeAvailability, pref_service); |
| 486 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 485 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
| 487 | 486 |
| 488 initialized_on_UI_thread_ = true; | 487 initialized_on_UI_thread_ = true; |
| 489 | 488 |
| 490 #if defined(OS_ANDROID) | |
| 491 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 492 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
| 493 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, | |
| 494 base::Unretained(this), g_browser_process->io_thread(), profile)); | |
| 495 #endif | |
| 496 #endif | |
| 497 | |
| 498 // We need to make sure that content initializes its own data structures that | 489 // We need to make sure that content initializes its own data structures that |
| 499 // are associated with each ResourceContext because we might post this | 490 // are associated with each ResourceContext because we might post this |
| 500 // object to the IO thread after this function. | 491 // object to the IO thread after this function. |
| 501 BrowserContext::EnsureResourceContextInitialized(profile); | 492 BrowserContext::EnsureResourceContextInitialized(profile); |
| 502 } | 493 } |
| 503 | 494 |
| 504 #if defined(OS_ANDROID) | |
| 505 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 506 void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread( | |
| 507 IOThread* io_thread, Profile* profile) { | |
| 508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 509 IOThread::Globals* globals = io_thread->globals(); | |
| 510 DataReductionProxyUsageStats* usage_stats = | |
| 511 globals->data_reduction_proxy_usage_stats.get(); | |
| 512 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
| 513 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread, | |
| 514 base::Unretained(this), profile, usage_stats)); | |
| 515 } | |
| 516 | |
| 517 void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread( | |
| 518 Profile* profile, | |
| 519 DataReductionProxyUsageStats* usage_stats) { | |
| 520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 521 if (g_browser_process->profile_manager()->IsValidProfile(profile)) { | |
| 522 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = | |
| 523 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); | |
| 524 if (data_reduction_proxy_chrome_settings) { | |
| 525 data_reduction_proxy_chrome_settings->SetDataReductionProxyUsageStats( | |
| 526 usage_stats); | |
| 527 } | |
| 528 } | |
| 529 } | |
| 530 #endif | |
| 531 #endif | |
| 532 | |
| 533 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 495 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
| 534 } | 496 } |
| 535 | 497 |
| 536 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( | 498 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( |
| 537 scoped_ptr<net::HttpTransactionFactory> http_factory) { | 499 scoped_ptr<net::HttpTransactionFactory> http_factory) { |
| 538 http_factory_ = http_factory.Pass(); | 500 http_factory_ = http_factory.Pass(); |
| 539 set_http_transaction_factory(http_factory_.get()); | 501 set_http_transaction_factory(http_factory_.get()); |
| 540 } | 502 } |
| 541 | 503 |
| 542 ProfileIOData::MediaRequestContext::~MediaRequestContext() { | 504 ProfileIOData::MediaRequestContext::~MediaRequestContext() { |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 extensions_request_context_.reset(new ChromeURLRequestContext()); | 965 extensions_request_context_.reset(new ChromeURLRequestContext()); |
| 1004 | 966 |
| 1005 ChromeNetworkDelegate* network_delegate = | 967 ChromeNetworkDelegate* network_delegate = |
| 1006 new ChromeNetworkDelegate( | 968 new ChromeNetworkDelegate( |
| 1007 #if defined(ENABLE_EXTENSIONS) | 969 #if defined(ENABLE_EXTENSIONS) |
| 1008 io_thread_globals->extension_event_router_forwarder.get(), | 970 io_thread_globals->extension_event_router_forwarder.get(), |
| 1009 #else | 971 #else |
| 1010 NULL, | 972 NULL, |
| 1011 #endif | 973 #endif |
| 1012 &enable_referrers_); | 974 &enable_referrers_); |
| 1013 network_delegate->set_data_reduction_proxy_params( | |
| 1014 io_thread_globals->data_reduction_proxy_params.get()); | |
| 1015 network_delegate->set_data_reduction_proxy_usage_stats( | |
| 1016 io_thread_globals->data_reduction_proxy_usage_stats.get()); | |
| 1017 network_delegate->set_data_reduction_proxy_auth_request_handler( | |
| 1018 io_thread_globals->data_reduction_proxy_auth_request_handler.get()); | |
| 1019 network_delegate->set_on_resolve_proxy_handler( | |
| 1020 io_thread_globals->on_resolve_proxy_handler); | |
| 1021 if (command_line.HasSwitch(switches::kEnableClientHints)) | 975 if (command_line.HasSwitch(switches::kEnableClientHints)) |
| 1022 network_delegate->SetEnableClientHints(); | 976 network_delegate->SetEnableClientHints(); |
| 1023 network_delegate->set_extension_info_map( | 977 network_delegate->set_extension_info_map( |
| 1024 profile_params_->extension_info_map.get()); | 978 profile_params_->extension_info_map.get()); |
| 1025 #if defined(ENABLE_CONFIGURATION_POLICY) | 979 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 1026 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 980 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
| 1027 #endif | 981 #endif |
| 1028 network_delegate->set_profile(profile_params_->profile); | 982 network_delegate->set_profile(profile_params_->profile); |
| 1029 network_delegate->set_profile_path(profile_params_->path); | 983 network_delegate->set_profile_path(profile_params_->path); |
| 1030 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 984 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 void ProfileIOData::SetCookieSettingsForTesting( | 1225 void ProfileIOData::SetCookieSettingsForTesting( |
| 1272 CookieSettings* cookie_settings) { | 1226 CookieSettings* cookie_settings) { |
| 1273 DCHECK(!cookie_settings_.get()); | 1227 DCHECK(!cookie_settings_.get()); |
| 1274 cookie_settings_ = cookie_settings; | 1228 cookie_settings_ = cookie_settings; |
| 1275 } | 1229 } |
| 1276 | 1230 |
| 1277 void ProfileIOData::set_signin_names_for_testing( | 1231 void ProfileIOData::set_signin_names_for_testing( |
| 1278 SigninNamesOnIOThread* signin_names) { | 1232 SigninNamesOnIOThread* signin_names) { |
| 1279 signin_names_.reset(signin_names); | 1233 signin_names_.reset(signin_names); |
| 1280 } | 1234 } |
| OLD | NEW |