Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7468)

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1682942abe41a6da5fa133d5566eb8401caa5d21..62a5ad8ea4d4a78ddcad9edb4f21fd47372fc580 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 {
@@ -484,13 +490,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::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
@@ -498,8 +500,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
BrowserContext::EnsureResourceContextInitialized(profile);
}
-#if defined(OS_ANDROID)
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
void ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread(
IOThread* io_thread, Profile* profile) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -516,14 +516,38 @@ void ProfileIOData::SetDataReductionProxyUsageStatsOnUIThread(
DataReductionProxyUsageStats* usage_stats) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (g_browser_process->profile_manager()->IsValidProfile(profile)) {
+#if defined(OS_ANDROID)
bengr 2014/07/11 20:42:53 I think we need an API for initializing the proxy
Not at Google. Contact bengr 2014/07/16 22:41:33 Done.
DataReductionProxySettingsAndroid* proxySettingsAndroid =
DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(profile);
if (proxySettingsAndroid)
proxySettingsAndroid->SetDataReductionProxyUsageStats(usage_stats);
+#else
+
+ int flags = DataReductionProxyParams::kFallbackAllowed |
+ DataReductionProxyParams::kAllowed;
+
+ DataReductionProxySettings* proxySettings =
+ new DataReductionProxySettings(new DataReductionProxyParams(flags));
+ proxySettings->SetDataReductionProxyUsageStats(usage_stats);
+
+ PrefService* prefs = profile->GetPrefs();
+
+
+ scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
+ configurator(new DataReductionProxyChromeConfigurator(prefs));
+ proxySettings->SetProxyConfigurator(configurator.Pass());
+
+
+
+ proxySettings->InitDataReductionProxySettings(prefs,
+ g_browser_process->local_state(),
+ ProfileManager::GetActiveUserProfile()->GetRequestContext());
+ proxySettings->SetDataReductionProxyEnabled(true);
bengr 2014/07/11 20:42:53 Obviously, this must be removed and hooked to UI.
Not at Google. Contact bengr 2014/07/16 22:41:33 Removed
+
+#endif
+
}
}
-#endif
-#endif
ProfileIOData::MediaRequestContext::MediaRequestContext() {
}

Powered by Google App Engine
This is Rietveld 408576698