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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 #include "net/ssl/client_cert_store_win.h" | 136 #include "net/ssl/client_cert_store_win.h" |
137 #endif | 137 #endif |
138 | 138 |
139 #if defined(OS_MACOSX) | 139 #if defined(OS_MACOSX) |
140 #include "net/ssl/client_cert_store_mac.h" | 140 #include "net/ssl/client_cert_store_mac.h" |
141 #endif | 141 #endif |
142 | 142 |
143 using content::BrowserContext; | 143 using content::BrowserContext; |
144 using content::BrowserThread; | 144 using content::BrowserThread; |
145 using content::ResourceContext; | 145 using content::ResourceContext; |
146 using data_reduction_proxy::DataReductionProxyUsageStats; | |
147 | 146 |
148 namespace { | 147 namespace { |
149 | 148 |
150 #if defined(DEBUG_DEVTOOLS) | 149 #if defined(DEBUG_DEVTOOLS) |
151 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { | 150 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { |
152 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 151 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
153 bundled_path_prefix = "/" + bundled_path_prefix + "/"; | 152 bundled_path_prefix = "/" + bundled_path_prefix + "/"; |
154 | 153 |
155 if (!url.SchemeIs(content::kChromeDevToolsScheme) || | 154 if (!url.SchemeIs(content::kChromeDevToolsScheme) || |
156 url.host() != chrome::kChromeUIDevToolsHost || | 155 url.host() != chrome::kChromeUIDevToolsHost || |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 497 } |
499 } | 498 } |
500 #endif | 499 #endif |
501 | 500 |
502 incognito_availibility_pref_.Init( | 501 incognito_availibility_pref_.Init( |
503 prefs::kIncognitoModeAvailability, pref_service); | 502 prefs::kIncognitoModeAvailability, pref_service); |
504 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 503 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
505 | 504 |
506 initialized_on_UI_thread_ = true; | 505 initialized_on_UI_thread_ = true; |
507 | 506 |
508 #if defined(OS_ANDROID) | |
509 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
510 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
511 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, | |
512 base::Unretained(this), g_browser_process->io_thread(), profile)); | |
513 #endif | |
514 #endif | |
515 | |
516 // We need to make sure that content initializes its own data structures that | 507 // We need to make sure that content initializes its own data structures that |
517 // are associated with each ResourceContext because we might post this | 508 // are associated with each ResourceContext because we might post this |
518 // object to the IO thread after this function. | 509 // object to the IO thread after this function. |
519 BrowserContext::EnsureResourceContextInitialized(profile); | 510 BrowserContext::EnsureResourceContextInitialized(profile); |
520 } | 511 } |
521 | 512 |
522 #if defined(OS_ANDROID) | |
523 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
524 void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread( | |
525 IOThread* io_thread, Profile* profile) { | |
526 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
527 IOThread::Globals* globals = io_thread->globals(); | |
528 DataReductionProxyUsageStats* usage_stats = | |
529 globals->data_reduction_proxy_usage_stats.get(); | |
530 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
531 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread, | |
532 base::Unretained(this), profile, usage_stats)); | |
533 } | |
534 | |
535 void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread( | |
536 Profile* profile, | |
537 DataReductionProxyUsageStats* usage_stats) { | |
538 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
539 if (g_browser_process->profile_manager()->IsValidProfile(profile)) { | |
540 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = | |
541 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); | |
542 if (data_reduction_proxy_chrome_settings) { | |
543 data_reduction_proxy_chrome_settings->SetDataReductionProxyUsageStats( | |
544 usage_stats); | |
545 } | |
546 } | |
547 } | |
548 #endif | |
549 #endif | |
550 | |
551 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 513 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
552 } | 514 } |
553 | 515 |
554 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( | 516 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( |
555 scoped_ptr<net::HttpTransactionFactory> http_factory) { | 517 scoped_ptr<net::HttpTransactionFactory> http_factory) { |
556 http_factory_ = http_factory.Pass(); | 518 http_factory_ = http_factory.Pass(); |
557 set_http_transaction_factory(http_factory_.get()); | 519 set_http_transaction_factory(http_factory_.get()); |
558 } | 520 } |
559 | 521 |
560 ProfileIOData::MediaRequestContext::~MediaRequestContext() { | 522 ProfileIOData::MediaRequestContext::~MediaRequestContext() { |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 extensions_request_context_.reset(new net::URLRequestContext()); | 996 extensions_request_context_.reset(new net::URLRequestContext()); |
1035 | 997 |
1036 ChromeNetworkDelegate* network_delegate = | 998 ChromeNetworkDelegate* network_delegate = |
1037 new ChromeNetworkDelegate( | 999 new ChromeNetworkDelegate( |
1038 #if defined(ENABLE_EXTENSIONS) | 1000 #if defined(ENABLE_EXTENSIONS) |
1039 io_thread_globals->extension_event_router_forwarder.get(), | 1001 io_thread_globals->extension_event_router_forwarder.get(), |
1040 #else | 1002 #else |
1041 NULL, | 1003 NULL, |
1042 #endif | 1004 #endif |
1043 &enable_referrers_); | 1005 &enable_referrers_); |
1044 network_delegate->set_data_reduction_proxy_params( | |
1045 io_thread_globals->data_reduction_proxy_params.get()); | |
1046 network_delegate->set_data_reduction_proxy_usage_stats( | |
1047 io_thread_globals->data_reduction_proxy_usage_stats.get()); | |
1048 network_delegate->set_data_reduction_proxy_auth_request_handler( | |
1049 io_thread_globals->data_reduction_proxy_auth_request_handler.get()); | |
1050 network_delegate->set_on_resolve_proxy_handler( | |
1051 io_thread_globals->on_resolve_proxy_handler); | |
1052 if (command_line.HasSwitch(switches::kEnableClientHints)) | 1006 if (command_line.HasSwitch(switches::kEnableClientHints)) |
1053 network_delegate->SetEnableClientHints(); | 1007 network_delegate->SetEnableClientHints(); |
1054 #if defined(ENABLE_EXTENSIONS) | 1008 #if defined(ENABLE_EXTENSIONS) |
1055 network_delegate->set_extension_info_map( | 1009 network_delegate->set_extension_info_map( |
1056 profile_params_->extension_info_map.get()); | 1010 profile_params_->extension_info_map.get()); |
1057 #endif | 1011 #endif |
1058 #if defined(ENABLE_CONFIGURATION_POLICY) | 1012 #if defined(ENABLE_CONFIGURATION_POLICY) |
1059 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 1013 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1060 #endif | 1014 #endif |
1061 network_delegate->set_profile(profile_params_->profile); | 1015 network_delegate->set_profile(profile_params_->profile); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 void ProfileIOData::SetCookieSettingsForTesting( | 1270 void ProfileIOData::SetCookieSettingsForTesting( |
1317 CookieSettings* cookie_settings) { | 1271 CookieSettings* cookie_settings) { |
1318 DCHECK(!cookie_settings_.get()); | 1272 DCHECK(!cookie_settings_.get()); |
1319 cookie_settings_ = cookie_settings; | 1273 cookie_settings_ = cookie_settings; |
1320 } | 1274 } |
1321 | 1275 |
1322 void ProfileIOData::set_signin_names_for_testing( | 1276 void ProfileIOData::set_signin_names_for_testing( |
1323 SigninNamesOnIOThread* signin_names) { | 1277 SigninNamesOnIOThread* signin_names) { |
1324 signin_names_.reset(signin_names); | 1278 signin_names_.reset(signin_names); |
1325 } | 1279 } |
OLD | NEW |