Chromium Code Reviews| Index: chrome/browser/profiles/profile_io_data.cc |
| diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc |
| index f4d4c14d23a26ee3e73308208f82930ef7a89b6a..2790b4c7bb89b9600c0f18173ca2b2ef84760510 100644 |
| --- a/chrome/browser/profiles/profile_io_data.cc |
| +++ b/chrome/browser/profiles/profile_io_data.cc |
| @@ -42,6 +42,7 @@ |
| #include "chrome/browser/net/chrome_network_delegate.h" |
| #include "chrome/browser/net/cookie_store_util.h" |
| #include "chrome/browser/net/proxy_service_factory.h" |
| +#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/signin/signin_names_io_thread.h" |
| @@ -49,6 +50,9 @@ |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_configurator.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h" |
| #include "components/startup_metric_utils/startup_metric_utils.h" |
| #include "components/sync_driver/pref_names.h" |
| #include "components/url_fixer/url_fixer.h" |
| @@ -136,6 +140,8 @@ |
| using content::BrowserContext; |
| using content::BrowserThread; |
| using content::ResourceContext; |
| +using data_reduction_proxy::DataReductionProxyParams; |
| +using data_reduction_proxy::DataReductionProxySettings; |
| using data_reduction_proxy::DataReductionProxyUsageStats; |
| namespace { |
| @@ -487,13 +493,9 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
| initialized_on_UI_thread_ = true; |
| -#if defined(OS_ANDROID) |
| -#if defined(SPDY_PROXY_AUTH_ORIGIN) |
| BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| - base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, |
| + base::Bind(&ProfileIOData::SetupDataReductionProxyOnIOThread, |
| base::Unretained(this), g_browser_process->io_thread(), profile)); |
| -#endif |
| -#endif |
| // We need to make sure that content initializes its own data structures that |
| // are associated with each ResourceContext because we might post this |
| @@ -501,32 +503,36 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
| BrowserContext::EnsureResourceContextInitialized(profile); |
| } |
| -#if defined(OS_ANDROID) |
| -#if defined(SPDY_PROXY_AUTH_ORIGIN) |
| -void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread( |
| +void ProfileIOData::SetupDataReductionProxyOnIOThread( |
| IOThread* io_thread, Profile* profile) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| IOThread::Globals* globals = io_thread->globals(); |
| + DataReductionProxyParams* params = globals->data_reduction_proxy_params.get(); |
| DataReductionProxyUsageStats* usage_stats = |
| globals->data_reduction_proxy_usage_stats.get(); |
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| - base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread, |
| - base::Unretained(this), profile, usage_stats)); |
| + base::Bind(&ProfileIOData::SetupDataReductionProxyOnUIThread, |
| + base::Unretained(this), profile, params, usage_stats)); |
| } |
| -void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread( |
| +void ProfileIOData::SetupDataReductionProxyOnUIThread( |
| Profile* profile, |
| + DataReductionProxyParams* params, |
| DataReductionProxyUsageStats* usage_stats) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + DCHECK(profile); |
| + DCHECK(params); |
| + DCHECK(usage_stats); |
| if (g_browser_process->profile_manager()->IsValidProfile(profile)) { |
| +// TODO(kundaji): Combine code to initialize DRP on different platforms. |
| +#if defined(OS_ANDROID) |
| DataReductionProxySettingsAndroid* proxySettingsAndroid = |
| DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(profile); |
| if (proxySettingsAndroid) |
| proxySettingsAndroid->SetDataReductionProxyUsageStats(usage_stats); |
| +#endif |
| } |
| } |
| -#endif |
| -#endif |
| ProfileIOData::MediaRequestContext::MediaRequestContext() { |
| } |
| @@ -1041,6 +1047,11 @@ void ProfileIOData::Init( |
| profile_params_->proxy_config_service.release(), |
| command_line, |
| quick_check_enabled_.GetValue())); |
| + DCHECK(io_thread_globals->data_reduction_proxy_params); |
| + proxy_service_->SetDataReductionProxyOrigins( |
| + io_thread_globals->data_reduction_proxy_params->GetDefaultOrigin(), |
|
bengr
2014/07/21 22:45:14
origin() and fallback_origin()?
Not at Google. Contact bengr
2014/07/22 00:12:09
Done.
|
| + io_thread_globals->data_reduction_proxy_params-> |
| + GetDefaultFallbackOrigin()); |
| transport_security_state_.reset(new net::TransportSecurityState()); |
| transport_security_persister_.reset( |