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 24 matching lines...) Expand all Loading... | |
35 #include "chrome/browser/extensions/extension_resource_protocols.h" | 35 #include "chrome/browser/extensions/extension_resource_protocols.h" |
36 #include "chrome/browser/io_thread.h" | 36 #include "chrome/browser/io_thread.h" |
37 #include "chrome/browser/media/media_device_id_salt.h" | 37 #include "chrome/browser/media/media_device_id_salt.h" |
38 #include "chrome/browser/net/about_protocol_handler.h" | 38 #include "chrome/browser/net/about_protocol_handler.h" |
39 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" | 39 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
40 #include "chrome/browser/net/chrome_http_user_agent_settings.h" | 40 #include "chrome/browser/net/chrome_http_user_agent_settings.h" |
41 #include "chrome/browser/net/chrome_net_log.h" | 41 #include "chrome/browser/net/chrome_net_log.h" |
42 #include "chrome/browser/net/chrome_network_delegate.h" | 42 #include "chrome/browser/net/chrome_network_delegate.h" |
43 #include "chrome/browser/net/cookie_store_util.h" | 43 #include "chrome/browser/net/cookie_store_util.h" |
44 #include "chrome/browser/net/proxy_service_factory.h" | 44 #include "chrome/browser/net/proxy_service_factory.h" |
45 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" | |
45 #include "chrome/browser/profiles/profile.h" | 46 #include "chrome/browser/profiles/profile.h" |
46 #include "chrome/browser/profiles/profile_manager.h" | 47 #include "chrome/browser/profiles/profile_manager.h" |
47 #include "chrome/browser/signin/signin_names_io_thread.h" | 48 #include "chrome/browser/signin/signin_names_io_thread.h" |
48 #include "chrome/common/chrome_paths.h" | 49 #include "chrome/common/chrome_paths.h" |
49 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
51 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
53 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h" | |
54 #include "components/data_reduction_proxy/browser/data_reduction_proxy_configura tor.h" | |
55 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
52 #include "components/startup_metric_utils/startup_metric_utils.h" | 56 #include "components/startup_metric_utils/startup_metric_utils.h" |
53 #include "components/sync_driver/pref_names.h" | 57 #include "components/sync_driver/pref_names.h" |
54 #include "components/url_fixer/url_fixer.h" | 58 #include "components/url_fixer/url_fixer.h" |
55 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
56 #include "content/public/browser/host_zoom_map.h" | 60 #include "content/public/browser/host_zoom_map.h" |
57 #include "content/public/browser/notification_service.h" | 61 #include "content/public/browser/notification_service.h" |
58 #include "content/public/browser/resource_context.h" | 62 #include "content/public/browser/resource_context.h" |
59 #include "extensions/browser/extension_protocols.h" | 63 #include "extensions/browser/extension_protocols.h" |
60 #include "extensions/browser/extension_system.h" | 64 #include "extensions/browser/extension_system.h" |
61 #include "extensions/browser/info_map.h" | 65 #include "extensions/browser/info_map.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 #include "net/ssl/client_cert_store_win.h" | 133 #include "net/ssl/client_cert_store_win.h" |
130 #endif | 134 #endif |
131 | 135 |
132 #if defined(OS_MACOSX) | 136 #if defined(OS_MACOSX) |
133 #include "net/ssl/client_cert_store_mac.h" | 137 #include "net/ssl/client_cert_store_mac.h" |
134 #endif | 138 #endif |
135 | 139 |
136 using content::BrowserContext; | 140 using content::BrowserContext; |
137 using content::BrowserThread; | 141 using content::BrowserThread; |
138 using content::ResourceContext; | 142 using content::ResourceContext; |
143 using data_reduction_proxy::DataReductionProxyParams; | |
144 using data_reduction_proxy::DataReductionProxySettings; | |
139 using data_reduction_proxy::DataReductionProxyUsageStats; | 145 using data_reduction_proxy::DataReductionProxyUsageStats; |
Ryan Sleevi
2014/07/22 01:56:31
General consensus is that such using statements ar
Not at Google. Contact bengr
2014/07/22 23:03:53
Can you please clarify why using "using" for data_
Ryan Sleevi
2014/07/23 00:54:44
This thread ( https://groups.google.com/a/chromium
Not at Google. Contact bengr
2014/08/26 17:31:08
Done
| |
140 | 146 |
141 namespace { | 147 namespace { |
142 | 148 |
143 #if defined(DEBUG_DEVTOOLS) | 149 #if defined(DEBUG_DEVTOOLS) |
144 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { | 150 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { |
145 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 151 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
146 bundled_path_prefix = "/" + bundled_path_prefix + "/"; | 152 bundled_path_prefix = "/" + bundled_path_prefix + "/"; |
147 | 153 |
148 if (!url.SchemeIs(content::kChromeDevToolsScheme) || | 154 if (!url.SchemeIs(content::kChromeDevToolsScheme) || |
149 url.host() != chrome::kChromeUIDevToolsHost || | 155 url.host() != chrome::kChromeUIDevToolsHost || |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 } | 486 } |
481 } | 487 } |
482 #endif | 488 #endif |
483 | 489 |
484 incognito_availibility_pref_.Init( | 490 incognito_availibility_pref_.Init( |
485 prefs::kIncognitoModeAvailability, pref_service); | 491 prefs::kIncognitoModeAvailability, pref_service); |
486 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 492 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
487 | 493 |
488 initialized_on_UI_thread_ = true; | 494 initialized_on_UI_thread_ = true; |
489 | 495 |
490 #if defined(OS_ANDROID) | |
491 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
492 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 496 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
493 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, | 497 base::Bind(&ProfileIOData::SetupDataReductionProxyOnIOThread, |
494 base::Unretained(this), g_browser_process->io_thread(), profile)); | 498 base::Unretained(this), g_browser_process->io_thread(), profile)); |
495 #endif | |
496 #endif | |
497 | 499 |
498 // We need to make sure that content initializes its own data structures that | 500 // We need to make sure that content initializes its own data structures that |
499 // are associated with each ResourceContext because we might post this | 501 // are associated with each ResourceContext because we might post this |
500 // object to the IO thread after this function. | 502 // object to the IO thread after this function. |
501 BrowserContext::EnsureResourceContextInitialized(profile); | 503 BrowserContext::EnsureResourceContextInitialized(profile); |
502 } | 504 } |
503 | 505 |
504 #if defined(OS_ANDROID) | 506 void ProfileIOData::SetupDataReductionProxyOnIOThread( |
505 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
506 void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread( | |
507 IOThread* io_thread, Profile* profile) { | 507 IOThread* io_thread, Profile* profile) { |
508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
509 IOThread::Globals* globals = io_thread->globals(); | 509 IOThread::Globals* globals = io_thread->globals(); |
510 DataReductionProxyParams* params = globals->data_reduction_proxy_params.get(); | |
510 DataReductionProxyUsageStats* usage_stats = | 511 DataReductionProxyUsageStats* usage_stats = |
511 globals->data_reduction_proxy_usage_stats.get(); | 512 globals->data_reduction_proxy_usage_stats.get(); |
512 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 513 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
513 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread, | 514 base::Bind(&ProfileIOData::SetupDataReductionProxyOnUIThread, |
514 base::Unretained(this), profile, usage_stats)); | 515 base::Unretained(this), profile, params, usage_stats)); |
515 } | 516 } |
516 | 517 |
517 void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread( | 518 void ProfileIOData::SetupDataReductionProxyOnUIThread( |
518 Profile* profile, | 519 Profile* profile, |
520 DataReductionProxyParams* params, | |
519 DataReductionProxyUsageStats* usage_stats) { | 521 DataReductionProxyUsageStats* usage_stats) { |
520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
523 DCHECK(profile); | |
524 DCHECK(params); | |
525 DCHECK(usage_stats); | |
521 if (g_browser_process->profile_manager()->IsValidProfile(profile)) { | 526 if (g_browser_process->profile_manager()->IsValidProfile(profile)) { |
527 // TODO(kundaji): Combine code to initialize DRP on different platforms. | |
528 #if defined(OS_ANDROID) | |
522 DataReductionProxySettingsAndroid* proxySettingsAndroid = | 529 DataReductionProxySettingsAndroid* proxySettingsAndroid = |
Ryan Sleevi
2014/07/22 01:56:31
STYLE: This variable name is wrong. Please fix to
Not at Google. Contact bengr
2014/07/22 23:03:53
Done.
| |
523 DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(profile); | 530 DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(profile); |
524 if (proxySettingsAndroid) | 531 if (proxySettingsAndroid) |
525 proxySettingsAndroid->SetDataReductionProxyUsageStats(usage_stats); | 532 proxySettingsAndroid->SetDataReductionProxyUsageStats(usage_stats); |
533 #endif | |
526 } | 534 } |
527 } | 535 } |
528 #endif | |
529 #endif | |
530 | 536 |
531 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 537 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
532 } | 538 } |
533 | 539 |
534 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( | 540 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( |
535 scoped_ptr<net::HttpTransactionFactory> http_factory) { | 541 scoped_ptr<net::HttpTransactionFactory> http_factory) { |
536 http_factory_ = http_factory.Pass(); | 542 http_factory_ = http_factory.Pass(); |
537 set_http_transaction_factory(http_factory_.get()); | 543 set_http_transaction_factory(http_factory_.get()); |
538 } | 544 } |
539 | 545 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1034 // NOTE: Proxy service uses the default io thread network delegate, not the | 1040 // NOTE: Proxy service uses the default io thread network delegate, not the |
1035 // delegate just created. | 1041 // delegate just created. |
1036 proxy_service_.reset( | 1042 proxy_service_.reset( |
1037 ProxyServiceFactory::CreateProxyService( | 1043 ProxyServiceFactory::CreateProxyService( |
1038 io_thread->net_log(), | 1044 io_thread->net_log(), |
1039 io_thread_globals->proxy_script_fetcher_context.get(), | 1045 io_thread_globals->proxy_script_fetcher_context.get(), |
1040 io_thread_globals->system_network_delegate.get(), | 1046 io_thread_globals->system_network_delegate.get(), |
1041 profile_params_->proxy_config_service.release(), | 1047 profile_params_->proxy_config_service.release(), |
1042 command_line, | 1048 command_line, |
1043 quick_check_enabled_.GetValue())); | 1049 quick_check_enabled_.GetValue())); |
1050 DCHECK(io_thread_globals->data_reduction_proxy_params); | |
1051 proxy_service_->SetDataReductionProxyOrigins( | |
1052 io_thread_globals->data_reduction_proxy_params->origin(), | |
1053 io_thread_globals->data_reduction_proxy_params->fallback_origin()); | |
1044 | 1054 |
1045 transport_security_state_.reset(new net::TransportSecurityState()); | 1055 transport_security_state_.reset(new net::TransportSecurityState()); |
1046 transport_security_persister_.reset( | 1056 transport_security_persister_.reset( |
1047 new net::TransportSecurityPersister( | 1057 new net::TransportSecurityPersister( |
1048 transport_security_state_.get(), | 1058 transport_security_state_.get(), |
1049 profile_params_->path, | 1059 profile_params_->path, |
1050 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 1060 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
1051 IsOffTheRecord())); | 1061 IsOffTheRecord())); |
1052 | 1062 |
1053 // Take ownership over these parameters. | 1063 // Take ownership over these parameters. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1265 void ProfileIOData::SetCookieSettingsForTesting( | 1275 void ProfileIOData::SetCookieSettingsForTesting( |
1266 CookieSettings* cookie_settings) { | 1276 CookieSettings* cookie_settings) { |
1267 DCHECK(!cookie_settings_.get()); | 1277 DCHECK(!cookie_settings_.get()); |
1268 cookie_settings_ = cookie_settings; | 1278 cookie_settings_ = cookie_settings; |
1269 } | 1279 } |
1270 | 1280 |
1271 void ProfileIOData::set_signin_names_for_testing( | 1281 void ProfileIOData::set_signin_names_for_testing( |
1272 SigninNamesOnIOThread* signin_names) { | 1282 SigninNamesOnIOThread* signin_names) { |
1273 signin_names_.reset(signin_names); | 1283 signin_names_.reset(signin_names); |
1274 } | 1284 } |
OLD | NEW |