| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "android_webview/native/aw_geolocation_permission_context.h" | |
| 6 | |
| 7 #include "android_webview/native/aw_contents.h" | |
| 8 #include "base/bind.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "content/public/browser/browser_thread.h" | |
| 11 #include "content/public/browser/render_view_host.h" | |
| 12 #include "content/public/browser/web_contents.h" | |
| 13 | |
| 14 namespace android_webview { | |
| 15 | |
| 16 AwGeolocationPermissionContext::~AwGeolocationPermissionContext() { | |
| 17 } | |
| 18 | |
| 19 void AwGeolocationPermissionContext::RequestGeolocationPermission( | |
| 20 content::WebContents* web_contents, | |
| 21 int bridge_id, | |
| 22 const GURL& requesting_frame, | |
| 23 bool user_gesture, | |
| 24 base::Callback<void(bool)> callback) { | |
| 25 AwContents* aw_contents = AwContents::FromWebContents(web_contents); | |
| 26 if (!aw_contents) { | |
| 27 callback.Run(false); | |
| 28 return; | |
| 29 } | |
| 30 aw_contents->ShowGeolocationPrompt(requesting_frame, callback); | |
| 31 } | |
| 32 | |
| 33 // static | |
| 34 content::GeolocationPermissionContext* | |
| 35 AwGeolocationPermissionContext::Create(AwBrowserContext* browser_context) { | |
| 36 return new AwGeolocationPermissionContext(); | |
| 37 } | |
| 38 | |
| 39 void AwGeolocationPermissionContext::CancelGeolocationPermissionRequest( | |
| 40 content::WebContents* web_contents, | |
| 41 int bridge_id, | |
| 42 const GURL& requesting_frame) { | |
| 43 AwContents* aw_contents = AwContents::FromWebContents(web_contents); | |
| 44 if (aw_contents) { | |
| 45 aw_contents->HideGeolocationPrompt(requesting_frame); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 } // namespace android_webview | |
| OLD | NEW |