Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / google / google_url_tracker_factory.cc
blob7830d543b7fdcbdda753117f7928210d75105276
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/google/google_url_tracker_factory.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/google/chrome_google_url_tracker_client.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/google/core/browser/google_pref_names.h"
12 #include "components/google/core/browser/google_url_tracker.h"
13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15 // static
16 GoogleURLTracker* GoogleURLTrackerFactory::GetForProfile(Profile* profile) {
17 return static_cast<GoogleURLTracker*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
21 // static
22 GoogleURLTrackerFactory* GoogleURLTrackerFactory::GetInstance() {
23 return Singleton<GoogleURLTrackerFactory>::get();
26 GoogleURLTrackerFactory::GoogleURLTrackerFactory()
27 : BrowserContextKeyedServiceFactory(
28 "GoogleURLTracker",
29 BrowserContextDependencyManager::GetInstance()) {
32 GoogleURLTrackerFactory::~GoogleURLTrackerFactory() {
35 KeyedService* GoogleURLTrackerFactory::BuildServiceInstanceFor(
36 content::BrowserContext* context) const {
37 // Delete this now-unused pref.
38 // At some point in the future, this code can be removed entirely.
39 static_cast<Profile*>(context)->GetOriginalProfile()->GetPrefs()->ClearPref(
40 prefs::kLastPromptedGoogleURL);
42 scoped_ptr<GoogleURLTrackerClient> client(
43 new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context)));
44 return new GoogleURLTracker(client.Pass(), GoogleURLTracker::NORMAL_MODE);
47 void GoogleURLTrackerFactory::RegisterProfilePrefs(
48 user_prefs::PrefRegistrySyncable* user_prefs) {
49 GoogleURLTracker::RegisterProfilePrefs(user_prefs);
52 content::BrowserContext* GoogleURLTrackerFactory::GetBrowserContextToUse(
53 content::BrowserContext* context) const {
54 return chrome::GetBrowserContextRedirectedInIncognito(context);
57 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserContext() const {
58 return true;
61 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const {
62 return true;