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

Unified Diff: chrome/browser/android/preferences/website_preference_bridge.cc

Issue 2612993002: Make geolocation API and X-Geo header access consistent (Closed)
Patch Set: Fix some things; rebase Created 3 years, 11 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/preferences/website_preference_bridge.cc
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc
index f87de66a5a1e5a3f784e21d4759d8c4426c1ac7b..28c9c1662f0ac734717c5f012f226fbf50850889 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -18,6 +18,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "chrome/browser/android/search_geolocation/search_geolocation_service.h"
#include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
#include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
#include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
@@ -753,6 +754,36 @@ static void ClearBannerData(JNIEnv* env,
builder.BuildWebsiteSettingsPatternMatchesFilter()));
}
+static jboolean ShouldUseDSEGeolocationSetting(
+ JNIEnv* env,
+ const JavaParamRef<jclass>& clazz,
+ const JavaParamRef<jstring>& jorigin,
+ jboolean is_incognito) {
+ SearchGeolocationService* search_helper =
+ SearchGeolocationService::Factory::GetForBrowserContext(
+ GetActiveUserProfile(is_incognito));
+ return search_helper &&
+ search_helper->UseDSEGeolocationSetting(
+ url::Origin(GURL(ConvertJavaStringToUTF8(env, jorigin))));
+}
+
+static jboolean GetDSEGeolocationSetting(JNIEnv* env,
+ const JavaParamRef<jclass>& clazz) {
+ SearchGeolocationService* search_helper =
+ SearchGeolocationService::Factory::GetForBrowserContext(
+ GetActiveUserProfile(false));
raymes 2017/01/09 05:47:26 nit: document the boolean /* is_incognito */
benwells 2017/01/09 21:02:22 Done.
+ return search_helper->GetDSEGeolocationSetting();
+}
+
+static void SetDSEGeolocationSetting(JNIEnv* env,
+ const JavaParamRef<jclass>& clazz,
+ jboolean setting) {
+ SearchGeolocationService* search_helper =
+ SearchGeolocationService::Factory::GetForBrowserContext(
+ GetActiveUserProfile(false));
raymes 2017/01/09 05:47:26 nit: same here.
benwells 2017/01/09 21:02:22 Done.
+ return search_helper->SetDSEGeolocationSetting(setting);
+}
+
// Register native methods
bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
return RegisterNativesImpl(env);

Powered by Google App Engine
This is Rietveld 408576698