Commit ec445d80 authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Moving Previews Initialization call out of profile_impl_io_data

This CL moves the call to Init Previews into ProfileManager alongside
similar calls.

Bug: 896001
Change-Id: If1bcecd73b9b5cab9f4ec101bd1e0e09867dba28
Reviewed-on: https://chromium-review.googlesource.com/c/1308990Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604757}
parent 01f7205e
......@@ -140,15 +140,21 @@ PreviewsLitePageDecider::PreviewsLitePageDecider(
DCHECK(!browser_context->IsOffTheRecord());
drp_settings_ = drp_settings;
drp_settings_->AddDataReductionProxySettingsObserver(this);
Profile* profile = Profile::FromBrowserContext(browser_context);
pref_service_ = profile->GetPrefs();
DCHECK(pref_service_);
host_blacklist_ =
pref_service_->GetDictionary(kHostBlacklist)->CreateDeepCopy();
// Add |this| as an observer to DRP, but if DRP is already initialized, check
// the prefs now.
drp_settings_ = drp_settings;
drp_settings_->AddDataReductionProxySettingsObserver(this);
if (drp_settings_->Config()) {
OnSettingsInitialized();
OnProxyRequestHeadersChanged(drp_settings->GetProxyRequestHeaders());
}
}
PreviewsLitePageDecider::~PreviewsLitePageDecider() = default;
......
......@@ -38,8 +38,6 @@
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/previews/previews_service.h"
#include "chrome/browser/previews/previews_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_features.h"
......@@ -178,13 +176,6 @@ void ProfileImplIOData::Handle::Init(
if (io_data_->lazy_params_->domain_reliability_monitor)
io_data_->lazy_params_->domain_reliability_monitor->MoveToNetworkThread();
// TODO(ryansturm): Move this call to a location unrelated to IO
// initialization. https://crbug.com/896001
PreviewsServiceFactory::GetForProfile(profile_)->Initialize(
g_browser_process->optimization_guide_service(),
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
profile_path);
io_data_->set_data_reduction_proxy_io_data(
CreateDataReductionProxyChromeIOData(
profile_->GetPrefs(),
......
......@@ -41,6 +41,8 @@
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/previews/previews_service.h"
#include "chrome/browser/previews/previews_service_factory.h"
#include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
......@@ -1344,6 +1346,13 @@ void ProfileManager::DoFinalInitForServices(Profile* profile,
DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile)->
MaybeActivateDataReductionProxy(true);
// Create the Previews Service and begin loading opt out history from
// persistent memory.
PreviewsServiceFactory::GetForProfile(profile)->Initialize(
g_browser_process->optimization_guide_service(),
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}),
profile->GetPath());
GaiaCookieManagerServiceFactory::GetForProfile(profile)->InitCookieListener();
invalidation::ProfileInvalidationProvider* invalidation_provider =
invalidation::DeprecatedProfileInvalidationProviderFactory::GetForProfile(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment