webview: Clean up JNI hop for geo location permission checks
This flag was added some time ago as we were considering changing how geo location permissions are granted. This is adding a JNI hop every time this is checked for a hardcoded value so cleaning that up and removing the dead code. Bug: 40375780 Change-Id: I58002ea5d9aa82cea5da3e8029ab912466fa537e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6264444 Reviewed-by: Richard (Torne) Coles <torne@chromium.org> Auto-Submit: Rupert Wiser <bewise@chromium.org> Commit-Queue: Richard (Torne) Coles <torne@chromium.org> Cr-Commit-Position: refs/heads/main@{#1419927}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3b30418113
commit
c57e52b485
android_webview
browser
java
src
org
chromium
android_webview
@ -724,13 +724,8 @@ void AwContents::RequestGeolocationPermission(const GURL& origin,
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
if (UseLegacyGeolocationPermissionAPI()) {
|
||||
ShowGeolocationPrompt(origin, std::move(callback));
|
||||
return;
|
||||
}
|
||||
permission_request_handler_->SendRequest(
|
||||
std::make_unique<SimplePermissionRequest>(
|
||||
origin, AwPermissionRequest::Geolocation, std::move(callback)));
|
||||
ShowGeolocationPrompt(origin, std::move(callback));
|
||||
return;
|
||||
}
|
||||
|
||||
void AwContents::CancelGeolocationPermissionRequests(const GURL& origin) {
|
||||
@ -739,23 +734,8 @@ void AwContents::CancelGeolocationPermissionRequests(const GURL& origin) {
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
if (UseLegacyGeolocationPermissionAPI()) {
|
||||
HideGeolocationPrompt(origin);
|
||||
return;
|
||||
}
|
||||
permission_request_handler_->CancelRequest(origin,
|
||||
AwPermissionRequest::Geolocation);
|
||||
}
|
||||
|
||||
bool AwContents::UseLegacyGeolocationPermissionAPI() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
JNIEnv* env = AttachCurrentThread();
|
||||
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Java_AwContents_useLegacyGeolocationPermissionAPI(env, obj);
|
||||
HideGeolocationPrompt(origin);
|
||||
return;
|
||||
}
|
||||
|
||||
void AwContents::RequestMIDISysexPermission(const GURL& origin,
|
||||
|
@ -327,8 +327,6 @@ class AwContents : public FindHelper::Listener,
|
||||
void RendererUnresponsive(content::RenderProcessHost* render_process_host);
|
||||
void RendererResponsive(content::RenderProcessHost* render_process_host);
|
||||
|
||||
bool UseLegacyGeolocationPermissionAPI();
|
||||
|
||||
// content::WebContentsObserver overrides
|
||||
void PrimaryPageChanged(content::Page& page) override;
|
||||
void DidFinishNavigation(
|
||||
|
@ -617,12 +617,7 @@ PermissionStatus AwPermissionManager::GetGeolocationPermission(
|
||||
if (!settings->geolocation_enabled()) {
|
||||
return PermissionStatus::DENIED;
|
||||
}
|
||||
AwContents* aw_contents = AwContents::FromWebContents(web_contents);
|
||||
if (!aw_contents->UseLegacyGeolocationPermissionAPI()) {
|
||||
// The new geolocation API does not have a cache for permission decisions,
|
||||
// so if that's in use, we will need to ask the app.
|
||||
return PermissionStatus::ASK;
|
||||
}
|
||||
|
||||
return context_delegate_->GetGeolocationPermission(requesting_origin);
|
||||
}
|
||||
|
||||
|
@ -4738,15 +4738,6 @@ public class AwContents implements SmartClipProvider {
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if the GeolocationPermissionAPI should be used.
|
||||
@CalledByNative
|
||||
private boolean useLegacyGeolocationPermissionAPI() {
|
||||
// Always return true since we are not ready to swap the geolocation yet.
|
||||
// TODO: If we decide not to migrate the geolocation, there are some unreachable
|
||||
// code need to remove. http://crbug.com/396184.
|
||||
return true;
|
||||
}
|
||||
|
||||
@NativeMethods
|
||||
interface Natives {
|
||||
long init(long browserContextPointer);
|
||||
|
Reference in New Issue
Block a user