OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/google/google_url_tracker_factory.h" | 5 #include "chrome/browser/google/google_url_tracker_factory.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/google/chrome_google_url_tracker_client.h" | 10 #include "chrome/browser/google/chrome_google_url_tracker_client.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "components/google/core/browser/google_pref_names.h" | 13 #include "components/google/core/browser/google_pref_names.h" |
12 #include "components/google/core/browser/google_url_tracker.h" | 14 #include "components/google/core/browser/google_url_tracker.h" |
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
14 | 16 |
15 // static | 17 // static |
16 GoogleURLTracker* GoogleURLTrackerFactory::GetForProfile(Profile* profile) { | 18 GoogleURLTracker* GoogleURLTrackerFactory::GetForProfile(Profile* profile) { |
(...skipping 17 matching lines...) Expand all Loading... |
34 | 36 |
35 KeyedService* GoogleURLTrackerFactory::BuildServiceInstanceFor( | 37 KeyedService* GoogleURLTrackerFactory::BuildServiceInstanceFor( |
36 content::BrowserContext* context) const { | 38 content::BrowserContext* context) const { |
37 // Delete this now-unused pref. | 39 // Delete this now-unused pref. |
38 // At some point in the future, this code can be removed entirely. | 40 // At some point in the future, this code can be removed entirely. |
39 static_cast<Profile*>(context)->GetOriginalProfile()->GetPrefs()->ClearPref( | 41 static_cast<Profile*>(context)->GetOriginalProfile()->GetPrefs()->ClearPref( |
40 prefs::kLastPromptedGoogleURL); | 42 prefs::kLastPromptedGoogleURL); |
41 | 43 |
42 scoped_ptr<GoogleURLTrackerClient> client( | 44 scoped_ptr<GoogleURLTrackerClient> client( |
43 new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context))); | 45 new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context))); |
44 return new GoogleURLTracker(client.Pass(), GoogleURLTracker::NORMAL_MODE); | 46 return new GoogleURLTracker(std::move(client), GoogleURLTracker::NORMAL_MODE); |
45 } | 47 } |
46 | 48 |
47 void GoogleURLTrackerFactory::RegisterProfilePrefs( | 49 void GoogleURLTrackerFactory::RegisterProfilePrefs( |
48 user_prefs::PrefRegistrySyncable* user_prefs) { | 50 user_prefs::PrefRegistrySyncable* user_prefs) { |
49 GoogleURLTracker::RegisterProfilePrefs(user_prefs); | 51 GoogleURLTracker::RegisterProfilePrefs(user_prefs); |
50 } | 52 } |
51 | 53 |
52 content::BrowserContext* GoogleURLTrackerFactory::GetBrowserContextToUse( | 54 content::BrowserContext* GoogleURLTrackerFactory::GetBrowserContextToUse( |
53 content::BrowserContext* context) const { | 55 content::BrowserContext* context) const { |
54 return chrome::GetBrowserContextRedirectedInIncognito(context); | 56 return chrome::GetBrowserContextRedirectedInIncognito(context); |
55 } | 57 } |
56 | 58 |
57 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserContext() const { | 59 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserContext() const { |
58 return true; | 60 return true; |
59 } | 61 } |
60 | 62 |
61 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { | 63 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { |
62 return true; | 64 return true; |
63 } | 65 } |
OLD | NEW |