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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 88 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
89 #endif | 89 #endif |
90 | 90 |
91 #if defined(ENABLE_MANAGED_USERS) | 91 #if defined(ENABLE_MANAGED_USERS) |
92 #include "chrome/browser/supervised_user/supervised_user_service.h" | 92 #include "chrome/browser/supervised_user/supervised_user_service.h" |
93 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 93 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
94 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 94 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
95 #endif | 95 #endif |
96 | 96 |
97 #if defined(OS_ANDROID) | 97 #if defined(OS_ANDROID) |
98 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" | |
99 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_and
roid.h" | |
100 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" | 98 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" |
101 #endif // defined(OS_ANDROID) | 99 #endif // defined(OS_ANDROID) |
102 | 100 |
103 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
104 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 102 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
105 #include "chrome/browser/chromeos/login/startup_utils.h" | 103 #include "chrome/browser/chromeos/login/startup_utils.h" |
106 #include "chrome/browser/chromeos/login/users/user.h" | 104 #include "chrome/browser/chromeos/login/users/user.h" |
107 #include "chrome/browser/chromeos/login/users/user_manager.h" | 105 #include "chrome/browser/chromeos/login/users/user_manager.h" |
108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 106 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
109 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 107 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
129 #include "net/ssl/client_cert_store_win.h" | 127 #include "net/ssl/client_cert_store_win.h" |
130 #endif | 128 #endif |
131 | 129 |
132 #if defined(OS_MACOSX) | 130 #if defined(OS_MACOSX) |
133 #include "net/ssl/client_cert_store_mac.h" | 131 #include "net/ssl/client_cert_store_mac.h" |
134 #endif | 132 #endif |
135 | 133 |
136 using content::BrowserContext; | 134 using content::BrowserContext; |
137 using content::BrowserThread; | 135 using content::BrowserThread; |
138 using content::ResourceContext; | 136 using content::ResourceContext; |
139 using data_reduction_proxy::DataReductionProxyUsageStats; | |
140 | 137 |
141 namespace { | 138 namespace { |
142 | 139 |
143 #if defined(DEBUG_DEVTOOLS) | 140 #if defined(DEBUG_DEVTOOLS) |
144 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { | 141 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { |
145 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 142 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
146 bundled_path_prefix = "/" + bundled_path_prefix + "/"; | 143 bundled_path_prefix = "/" + bundled_path_prefix + "/"; |
147 | 144 |
148 if (!url.SchemeIs(content::kChromeDevToolsScheme) || | 145 if (!url.SchemeIs(content::kChromeDevToolsScheme) || |
149 url.host() != chrome::kChromeUIDevToolsHost || | 146 url.host() != chrome::kChromeUIDevToolsHost || |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 477 } |
481 } | 478 } |
482 #endif | 479 #endif |
483 | 480 |
484 incognito_availibility_pref_.Init( | 481 incognito_availibility_pref_.Init( |
485 prefs::kIncognitoModeAvailability, pref_service); | 482 prefs::kIncognitoModeAvailability, pref_service); |
486 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 483 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
487 | 484 |
488 initialized_on_UI_thread_ = true; | 485 initialized_on_UI_thread_ = true; |
489 | 486 |
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 | 487 // We need to make sure that content initializes its own data structures that |
499 // are associated with each ResourceContext because we might post this | 488 // are associated with each ResourceContext because we might post this |
500 // object to the IO thread after this function. | 489 // object to the IO thread after this function. |
501 BrowserContext::EnsureResourceContextInitialized(profile); | 490 BrowserContext::EnsureResourceContextInitialized(profile); |
502 } | 491 } |
503 | 492 |
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 DataReductionProxySettingsAndroid* proxySettingsAndroid = | |
523 DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(profile); | |
524 if (proxySettingsAndroid) | |
525 proxySettingsAndroid->SetDataReductionProxyUsageStats(usage_stats); | |
526 } | |
527 } | |
528 #endif | |
529 #endif | |
530 | |
531 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 493 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
532 } | 494 } |
533 | 495 |
534 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( | 496 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( |
535 scoped_ptr<net::HttpTransactionFactory> http_factory) { | 497 scoped_ptr<net::HttpTransactionFactory> http_factory) { |
536 http_factory_ = http_factory.Pass(); | 498 http_factory_ = http_factory.Pass(); |
537 set_http_transaction_factory(http_factory_.get()); | 499 set_http_transaction_factory(http_factory_.get()); |
538 } | 500 } |
539 | 501 |
540 ProfileIOData::MediaRequestContext::~MediaRequestContext() { | 502 ProfileIOData::MediaRequestContext::~MediaRequestContext() { |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 extensions_request_context_.reset(new ChromeURLRequestContext()); | 963 extensions_request_context_.reset(new ChromeURLRequestContext()); |
1002 | 964 |
1003 ChromeNetworkDelegate* network_delegate = | 965 ChromeNetworkDelegate* network_delegate = |
1004 new ChromeNetworkDelegate( | 966 new ChromeNetworkDelegate( |
1005 #if defined(ENABLE_EXTENSIONS) | 967 #if defined(ENABLE_EXTENSIONS) |
1006 io_thread_globals->extension_event_router_forwarder.get(), | 968 io_thread_globals->extension_event_router_forwarder.get(), |
1007 #else | 969 #else |
1008 NULL, | 970 NULL, |
1009 #endif | 971 #endif |
1010 &enable_referrers_); | 972 &enable_referrers_); |
1011 network_delegate->set_data_reduction_proxy_params( | |
1012 io_thread_globals->data_reduction_proxy_params.get()); | |
1013 network_delegate->set_data_reduction_proxy_usage_stats( | |
1014 io_thread_globals->data_reduction_proxy_usage_stats.get()); | |
1015 network_delegate->set_data_reduction_proxy_auth_request_handler( | |
1016 io_thread_globals->data_reduction_proxy_auth_request_handler.get()); | |
1017 network_delegate->set_on_resolve_proxy_handler( | |
1018 io_thread_globals->on_resolve_proxy_handler); | |
1019 if (command_line.HasSwitch(switches::kEnableClientHints)) | 973 if (command_line.HasSwitch(switches::kEnableClientHints)) |
1020 network_delegate->SetEnableClientHints(); | 974 network_delegate->SetEnableClientHints(); |
1021 network_delegate->set_extension_info_map( | 975 network_delegate->set_extension_info_map( |
1022 profile_params_->extension_info_map.get()); | 976 profile_params_->extension_info_map.get()); |
1023 #if defined(ENABLE_CONFIGURATION_POLICY) | 977 #if defined(ENABLE_CONFIGURATION_POLICY) |
1024 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 978 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1025 #endif | 979 #endif |
1026 network_delegate->set_profile(profile_params_->profile); | 980 network_delegate->set_profile(profile_params_->profile); |
1027 network_delegate->set_profile_path(profile_params_->path); | 981 network_delegate->set_profile_path(profile_params_->path); |
1028 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 982 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 void ProfileIOData::SetCookieSettingsForTesting( | 1223 void ProfileIOData::SetCookieSettingsForTesting( |
1270 CookieSettings* cookie_settings) { | 1224 CookieSettings* cookie_settings) { |
1271 DCHECK(!cookie_settings_.get()); | 1225 DCHECK(!cookie_settings_.get()); |
1272 cookie_settings_ = cookie_settings; | 1226 cookie_settings_ = cookie_settings; |
1273 } | 1227 } |
1274 | 1228 |
1275 void ProfileIOData::set_signin_names_for_testing( | 1229 void ProfileIOData::set_signin_names_for_testing( |
1276 SigninNamesOnIOThread* signin_names) { | 1230 SigninNamesOnIOThread* signin_names) { |
1277 signin_names_.reset(signin_names); | 1231 signin_names_.reset(signin_names); |
1278 } | 1232 } |
OLD | NEW |