| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/android/search_geolocation/search_geolocation_service.h
" | 5 #include "chrome/browser/android/search_geolocation/search_geolocation_service.h
" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur
e_tab_helper.h" | 10 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur
e_tab_helper.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 bool SearchGeolocationService::Factory::ServiceIsCreatedWithBrowserContext() | 118 bool SearchGeolocationService::Factory::ServiceIsCreatedWithBrowserContext() |
| 119 const { | 119 const { |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 KeyedService* SearchGeolocationService::Factory::BuildServiceInstanceFor( | 123 KeyedService* SearchGeolocationService::Factory::BuildServiceInstanceFor( |
| 124 content::BrowserContext* context) const { | 124 content::BrowserContext* context) const { |
| 125 return new SearchGeolocationService(Profile::FromBrowserContext(context)); | 125 return new SearchGeolocationService(Profile::FromBrowserContext(context)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // static | 128 void SearchGeolocationService::Factory::RegisterProfilePrefs( |
| 129 void SearchGeolocationService::RegisterProfilePrefs( | |
| 130 user_prefs::PrefRegistrySyncable* registry) { | 129 user_prefs::PrefRegistrySyncable* registry) { |
| 131 registry->RegisterDictionaryPref(prefs::kGoogleDSEGeolocationSetting); | 130 registry->RegisterDictionaryPref(prefs::kGoogleDSEGeolocationSetting); |
| 132 } | 131 } |
| 133 | 132 |
| 134 SearchGeolocationService::SearchGeolocationService(Profile* profile) | 133 SearchGeolocationService::SearchGeolocationService(Profile* profile) |
| 135 : profile_(profile), | 134 : profile_(profile), |
| 136 pref_service_(profile_->GetPrefs()), | 135 pref_service_(profile_->GetPrefs()), |
| 137 host_content_settings_map_( | 136 host_content_settings_map_( |
| 138 HostContentSettingsMapFactory::GetForProfile(profile_)) { | 137 HostContentSettingsMapFactory::GetForProfile(profile_)) { |
| 139 // This class should never be constructed in incognito. | 138 // This class should never be constructed in incognito. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 bool SearchGeolocationService::UseConsistentSearchGeolocation() { | 312 bool SearchGeolocationService::UseConsistentSearchGeolocation() { |
| 314 return base::FeatureList::IsEnabled(features::kConsistentOmniboxGeolocation); | 313 return base::FeatureList::IsEnabled(features::kConsistentOmniboxGeolocation); |
| 315 } | 314 } |
| 316 | 315 |
| 317 void SearchGeolocationService::SetSearchEngineDelegateForTest( | 316 void SearchGeolocationService::SetSearchEngineDelegateForTest( |
| 318 std::unique_ptr<SearchEngineDelegate> delegate) { | 317 std::unique_ptr<SearchEngineDelegate> delegate) { |
| 319 delegate_ = std::move(delegate); | 318 delegate_ = std::move(delegate); |
| 320 delegate_->SetDSEChangedCallback(base::Bind( | 319 delegate_->SetDSEChangedCallback(base::Bind( |
| 321 &SearchGeolocationService::OnDSEChanged, base::Unretained(this))); | 320 &SearchGeolocationService::OnDSEChanged, base::Unretained(this))); |
| 322 } | 321 } |
| OLD | NEW |