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 "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/google/chrome_google_url_tracker_client.h" | 8 #include "chrome/browser/google/chrome_google_url_tracker_client.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 static_cast<Profile*>(context)->GetOriginalProfile()->GetPrefs()->ClearPref( | 47 static_cast<Profile*>(context)->GetOriginalProfile()->GetPrefs()->ClearPref( |
48 kLastPromptedGoogleURL); | 48 kLastPromptedGoogleURL); |
49 | 49 |
50 scoped_ptr<GoogleURLTrackerClient> client( | 50 scoped_ptr<GoogleURLTrackerClient> client( |
51 new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context))); | 51 new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context))); |
52 return new GoogleURLTracker(client.Pass(), GoogleURLTracker::NORMAL_MODE); | 52 return new GoogleURLTracker(client.Pass(), GoogleURLTracker::NORMAL_MODE); |
53 } | 53 } |
54 | 54 |
55 void GoogleURLTrackerFactory::RegisterProfilePrefs( | 55 void GoogleURLTrackerFactory::RegisterProfilePrefs( |
56 user_prefs::PrefRegistrySyncable* user_prefs) { | 56 user_prefs::PrefRegistrySyncable* user_prefs) { |
57 user_prefs->RegisterStringPref( | 57 user_prefs->RegisterStringPref(prefs::kLastKnownGoogleURL, |
58 prefs::kLastKnownGoogleURL, | 58 GoogleURLTracker::kDefaultGoogleHomepage); |
59 GoogleURLTracker::kDefaultGoogleHomepage, | 59 user_prefs->RegisterStringPref(kLastPromptedGoogleURL, std::string()); |
60 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
61 user_prefs->RegisterStringPref( | |
62 kLastPromptedGoogleURL, | |
63 std::string(), | |
64 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
65 } | 60 } |
66 | 61 |
67 content::BrowserContext* GoogleURLTrackerFactory::GetBrowserContextToUse( | 62 content::BrowserContext* GoogleURLTrackerFactory::GetBrowserContextToUse( |
68 content::BrowserContext* context) const { | 63 content::BrowserContext* context) const { |
69 return chrome::GetBrowserContextRedirectedInIncognito(context); | 64 return chrome::GetBrowserContextRedirectedInIncognito(context); |
70 } | 65 } |
71 | 66 |
72 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserContext() const { | 67 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserContext() const { |
73 return true; | 68 return true; |
74 } | 69 } |
75 | 70 |
76 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { | 71 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { |
77 return true; | 72 return true; |
78 } | 73 } |
OLD | NEW |