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

Side by Side Diff: chrome/browser/android/location_settings_impl.cc

Issue 2721293002: Show the Android Location Settings Dialog when sites want permission. (Closed)
Patch Set: Updated Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/android/location_settings_impl.h" 5 #include "chrome/browser/android/location_settings_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
9 #include "jni/LocationSettings_jni.h" 9 #include "jni/LocationSettings_jni.h"
10 10
11 using base::android::AttachCurrentThread; 11 using base::android::AttachCurrentThread;
12 12
13 using LocationSettingsDialogOutcome = 13 using LocationSettingsDialogOutcome =
14 LocationSettings::LocationSettingsDialogOutcome; 14 LocationSettings::LocationSettingsDialogOutcome;
15 using LocationSettingsDialogOutcomeCallback = 15 using LocationSettingsDialogOutcomeCallback =
16 LocationSettings::LocationSettingsDialogOutcomeCallback; 16 LocationSettings::LocationSettingsDialogOutcomeCallback;
17 17
18 LocationSettingsImpl::LocationSettingsImpl() {} 18 LocationSettingsImpl::LocationSettingsImpl() {}
19 19
20 LocationSettingsImpl::~LocationSettingsImpl() {} 20 LocationSettingsImpl::~LocationSettingsImpl() {}
21 21
22 bool LocationSettingsImpl::CanSitesRequestLocationPermission( 22 bool LocationSettingsImpl::HasAndroidLocationPermission() {
23 JNIEnv* env = AttachCurrentThread();
24 return Java_LocationSettings_hasAndroidLocationPermission(env);
25 }
26
27 bool LocationSettingsImpl::CanPromptForAndroidLocationPermission(
23 content::WebContents* web_contents) { 28 content::WebContents* web_contents) {
24 JNIEnv* env = AttachCurrentThread(); 29 JNIEnv* env = AttachCurrentThread();
25 return Java_LocationSettings_canSitesRequestLocationPermission( 30 return Java_LocationSettings_canPromptForAndroidLocationPermission(
26 env, web_contents->GetJavaWebContents()); 31 env, web_contents->GetJavaWebContents());
27 } 32 }
28 33
34 bool LocationSettingsImpl::IsSystemLocationSettingEnabled() {
35 JNIEnv* env = AttachCurrentThread();
36 return Java_LocationSettings_isSystemLocationSettingEnabled(env);
37 }
38
29 bool LocationSettingsImpl::CanPromptToEnableSystemLocationSetting() { 39 bool LocationSettingsImpl::CanPromptToEnableSystemLocationSetting() {
30 JNIEnv* env = AttachCurrentThread(); 40 JNIEnv* env = AttachCurrentThread();
31 return Java_LocationSettings_canPromptToEnableSystemLocationSetting(env); 41 return Java_LocationSettings_canPromptToEnableSystemLocationSetting(env);
32 } 42 }
33 43
34 void LocationSettingsImpl::PromptToEnableSystemLocationSetting( 44 void LocationSettingsImpl::PromptToEnableSystemLocationSetting(
35 const LocationSettingsDialogContext prompt_context, 45 const LocationSettingsDialogContext prompt_context,
36 content::WebContents* web_contents, 46 content::WebContents* web_contents,
37 LocationSettingsDialogOutcomeCallback callback) { 47 LocationSettingsDialogOutcomeCallback callback) {
38 JNIEnv* env = AttachCurrentThread(); 48 JNIEnv* env = AttachCurrentThread();
(...skipping 13 matching lines...) Expand all
52 reinterpret_cast<LocationSettingsDialogOutcomeCallback*>( 62 reinterpret_cast<LocationSettingsDialogOutcomeCallback*>(
53 callback_ptr); 63 callback_ptr);
54 std::move(*callback).Run(static_cast<LocationSettingsDialogOutcome>( 64 std::move(*callback).Run(static_cast<LocationSettingsDialogOutcome>(
55 result)); 65 result));
56 delete callback; 66 delete callback;
57 } 67 }
58 68
59 bool LocationSettingsImpl::Register(JNIEnv* env) { 69 bool LocationSettingsImpl::Register(JNIEnv* env) {
60 return RegisterNativesImpl(env); 70 return RegisterNativesImpl(env);
61 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698