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

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

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (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_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 771d9f5af4a7c6362ab77acc2da1e27c2b0167f0..bfebf549ad29cf42cc31f15aa4e4ca6acbfe004d 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -48,6 +48,7 @@
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/net/proxy_service_factory.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_prefs.h"
@@ -118,6 +119,11 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#endif
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
+#endif
+
#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/schema_registry_service.h"
#include "chrome/browser/policy/schema_registry_service_factory.h"
@@ -383,7 +389,8 @@ ProfileImpl::ProfileImpl(
last_session_exit_type_(EXIT_NORMAL),
start_time_(Time::Now()),
delegate_(delegate),
- predictor_(NULL) {
+ predictor_(NULL),
+ data_reduction_proxy_chrome_settings_(NULL) {
TRACE_EVENT0("browser", "ProfileImpl::ctor")
DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
"profile files to the root directory!";
@@ -598,6 +605,11 @@ void ProfileImpl::DoFinalInit() {
InitHostZoomMap();
+ base::Callback<void(bool)> data_reduction_proxy_unavailable;
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+ InitDataReductionProxy(&data_reduction_proxy_unavailable);
+#endif
+
// Make sure we initialize the ProfileIOData after everything else has been
// initialized that we might be reading from the IO thread.
@@ -605,7 +617,8 @@ void ProfileImpl::DoFinalInit() {
cache_max_size, media_cache_path, media_cache_max_size,
extensions_cookie_path, GetPath(), infinite_cache_path,
predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
- CreateDomainReliabilityMonitor());
+ CreateDomainReliabilityMonitor(),
+ data_reduction_proxy_unavailable);
#if defined(ENABLE_PLUGINS)
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
@@ -707,6 +720,29 @@ void ProfileImpl::InitHostZoomMap() {
base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this)));
}
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+void ProfileImpl::InitDataReductionProxy(
+ base::Callback<void(bool)>* unavailable_callback) {
+ data_reduction_proxy_chrome_settings_ =
+ DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
+
+ DCHECK(unavailable_callback);
willchan no longer on Chromium 2014/07/28 15:45:23 Don't bother with the DCHECK, since the next line
bengr 2014/07/28 20:29:04 Done.
+ *unavailable_callback =
+ base::Bind(
+ &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
+ base::Unretained(data_reduction_proxy_chrome_settings_));
+ // Post to prevent a Profile initialization loop.
willchan no longer on Chromium 2014/07/28 15:45:23 I don't understand this comment. What's the loop?
bengr 2014/07/28 20:29:04 The comment needs to change. Before changing to pa
willchan no longer on Chromium 2014/07/29 00:26:56 Can you paste the error?
willchan no longer on Chromium 2014/07/31 22:31:34 Ben and I chatted about this offline. The problem
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&ProfileImpl::RunInitDataReductionProxyTask,
+ base::Unretained(this)));
+}
+
+void ProfileImpl::RunInitDataReductionProxyTask() {
+ data_reduction_proxy_chrome_settings_->InitDataReductionProxySettings(this);
+}
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
+
base::FilePath ProfileImpl::last_selected_directory() {
return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
}

Powered by Google App Engine
This is Rietveld 408576698