Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: chrome/browser/android/search_geolocation/search_geolocation_service.cc

Issue 2804913005: Don't use the DSE geolocation setting when chrome doesn't have location. (Closed)
Patch Set: Fix other test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698