| 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 ead635ae0a8545dbc47cb737801da32e90a454f1..01cc81bedc697c26091858175771ed81a0462111 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"
|
| @@ -135,6 +139,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 {
|
| @@ -486,13 +492,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
|
| @@ -500,32 +502,45 @@ 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));
|
| 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);
|
| +#elif !defined(OS_IOS)
|
| + data_reduction_proxy_settings_.reset(
|
| + new DataReductionProxySettings(params));
|
| + data_reduction_proxy_settings_->SetDataReductionProxyUsageStats(
|
| + usage_stats);
|
| + PrefService* prefs = profile->GetPrefs();
|
| + scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
|
| + configurator(new DataReductionProxyChromeConfigurator(prefs));
|
| + data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass());
|
| + data_reduction_proxy_settings_->InitDataReductionProxySettings(prefs,
|
| + g_browser_process->local_state(),
|
| + ProfileManager::GetActiveUserProfile()->GetRequestContext());
|
| +#endif
|
| }
|
| }
|
| -#endif
|
| -#endif
|
|
|
| ProfileIOData::MediaRequestContext::MediaRequestContext() {
|
| }
|
| @@ -1028,6 +1043,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(),
|
| + io_thread_globals->data_reduction_proxy_params->
|
| + GetDefaultFallbackOrigin());
|
|
|
| transport_security_state_.reset(new net::TransportSecurityState());
|
| transport_security_persister_.reset(
|
|
|