| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/google/google_url_tracker_factory.h" | 5 #include "ios/chrome/browser/google/google_url_tracker_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "components/google/core/browser/google_pref_names.h" | 9 #include "components/google/core/browser/google_pref_names.h" |
| 10 #include "components/google/core/browser/google_url_tracker.h" | 10 #include "components/google/core/browser/google_url_tracker.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 std::unique_ptr<KeyedService> GoogleURLTrackerFactory::BuildServiceInstanceFor( | 40 std::unique_ptr<KeyedService> GoogleURLTrackerFactory::BuildServiceInstanceFor( |
| 41 web::BrowserState* context) const { | 41 web::BrowserState* context) const { |
| 42 ios::ChromeBrowserState* browser_state = | 42 ios::ChromeBrowserState* browser_state = |
| 43 ios::ChromeBrowserState::FromBrowserState(context); | 43 ios::ChromeBrowserState::FromBrowserState(context); |
| 44 | 44 |
| 45 // Delete this now-unused pref. | 45 // Delete this now-unused pref. |
| 46 // At some point in the future, this code can be removed entirely. | 46 // At some point in the future, this code can be removed entirely. |
| 47 browser_state->GetOriginalChromeBrowserState()->GetPrefs()->ClearPref( | 47 browser_state->GetOriginalChromeBrowserState()->GetPrefs()->ClearPref( |
| 48 prefs::kLastPromptedGoogleURL); | 48 prefs::kLastPromptedGoogleURL); |
| 49 | 49 |
| 50 return base::WrapUnique(new GoogleURLTracker( | 50 return base::MakeUnique<GoogleURLTracker>( |
| 51 base::WrapUnique(new GoogleURLTrackerClientImpl(browser_state)), | 51 base::WrapUnique(new GoogleURLTrackerClientImpl(browser_state)), |
| 52 GoogleURLTracker::NORMAL_MODE)); | 52 GoogleURLTracker::NORMAL_MODE); |
| 53 } | 53 } |
| 54 | 54 |
| 55 web::BrowserState* GoogleURLTrackerFactory::GetBrowserStateToUse( | 55 web::BrowserState* GoogleURLTrackerFactory::GetBrowserStateToUse( |
| 56 web::BrowserState* context) const { | 56 web::BrowserState* context) const { |
| 57 return GetBrowserStateRedirectedInIncognito(context); | 57 return GetBrowserStateRedirectedInIncognito(context); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserState() const { | 60 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserState() const { |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { | 64 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const { |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void GoogleURLTrackerFactory::RegisterBrowserStatePrefs( | 68 void GoogleURLTrackerFactory::RegisterBrowserStatePrefs( |
| 69 user_prefs::PrefRegistrySyncable* registry) { | 69 user_prefs::PrefRegistrySyncable* registry) { |
| 70 GoogleURLTracker::RegisterProfilePrefs(registry); | 70 GoogleURLTracker::RegisterProfilePrefs(registry); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace ios | 73 } // namespace ios |
| OLD | NEW |