Commit 15a8709f authored by sdefresne's avatar sdefresne Committed by Commit bot

Add missing dependency on TemplateURLService from PrefMetricsService

There is an indirect dependency from PrefMetricsService on TemplateURLService
that cause an incorrect ordering of the factories instantiation when using a
TestingProfile, as can be seen in the following callstack:

TemplateURLServiceFactory::GetForProfile(Profile*)
chrome::(anonymous namespace)::GetDefaultSearchProviderTemplateURL(Profile*)
chrome::(anonymous namespace)::NewTabURLDetails::ForProfile(Profile*)1
chrome::HandleNewTabURLRewrite(GURL*, content::BrowserContext*)
content::BrowserURLHandlerImpl::RewriteURLIfNecessary(GURL*, content::BrowserContext*, bool*)
(anonymous namespace)::SampleNewTabPageURL(Profile*)
PrefMetricsService::RecordLaunchPrefs()
PrefMetricsService::PrefMetricsService(Profile*)
PrefMetricsService::Factory::BuildServiceInstanceFor(content::BrowserContext*)

Add an explicit dependency to fix the ordering.

BUG=373326

Review URL: https://codereview.chromium.org/659973002

Cr-Commit-Position: refs/heads/master@{#299890}
parent 3e28946a
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "chrome/browser/prefs/synced_pref_change_registrar.h" #include "chrome/browser/prefs/synced_pref_change_registrar.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/tabs/pinned_tab_codec.h" #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -223,6 +224,7 @@ PrefMetricsService::Factory::Factory() ...@@ -223,6 +224,7 @@ PrefMetricsService::Factory::Factory()
: BrowserContextKeyedServiceFactory( : BrowserContextKeyedServiceFactory(
"PrefMetricsService", "PrefMetricsService",
BrowserContextDependencyManager::GetInstance()) { BrowserContextDependencyManager::GetInstance()) {
DependsOn(TemplateURLServiceFactory::GetInstance());
} }
PrefMetricsService::Factory::~Factory() { PrefMetricsService::Factory::~Factory() {
......
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