| Index: chrome/browser/android/search_geolocation/search_geolocation_service.cc
|
| diff --git a/chrome/browser/android/search_geolocation/search_geolocation_service.cc b/chrome/browser/android/search_geolocation/search_geolocation_service.cc
|
| index 7977997bc388d14e5911407c73c86ad6cbbe28a9..59f040a689f451345d778fbdf781cef667d085ce 100644
|
| --- a/chrome/browser/android/search_geolocation/search_geolocation_service.cc
|
| +++ b/chrome/browser/android/search_geolocation/search_geolocation_service.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/callback.h"
|
| #include "base/feature_list.h"
|
| #include "base/values.h"
|
| +#include "chrome/browser/android/location_settings_impl.h"
|
| #include "chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.h"
|
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -134,7 +135,8 @@ SearchGeolocationService::SearchGeolocationService(Profile* profile)
|
| : profile_(profile),
|
| pref_service_(profile_->GetPrefs()),
|
| host_content_settings_map_(
|
| - HostContentSettingsMapFactory::GetForProfile(profile_)) {
|
| + HostContentSettingsMapFactory::GetForProfile(profile_)),
|
| + location_settings_(new LocationSettingsImpl()) {
|
| // This class should never be constructed in incognito.
|
| DCHECK(!profile_->IsOffTheRecord());
|
|
|
| @@ -171,6 +173,9 @@ bool SearchGeolocationService::UseDSEGeolocationSetting(
|
| return false;
|
| }
|
|
|
| + if (!location_settings_->HasAndroidLocationPermission())
|
| + return false;
|
| +
|
| return true;
|
| }
|
|
|
| @@ -319,3 +324,8 @@ void SearchGeolocationService::SetSearchEngineDelegateForTest(
|
| delegate_->SetDSEChangedCallback(base::Bind(
|
| &SearchGeolocationService::OnDSEChanged, base::Unretained(this)));
|
| }
|
| +
|
| +void SearchGeolocationService::SetLocationSettingsForTest(
|
| + std::unique_ptr<LocationSettings> settings) {
|
| + location_settings_ = std::move(settings);
|
| +}
|
|
|