Index: android_webview/native/aw_geolocation_permission_context.cc |
diff --git a/android_webview/native/aw_geolocation_permission_context.cc b/android_webview/native/aw_geolocation_permission_context.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..830a4eb2308cae4b590fc137e54f327763b43753 |
--- /dev/null |
+++ b/android_webview/native/aw_geolocation_permission_context.cc |
@@ -0,0 +1,83 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "android_webview/native/aw_geolocation_permission_context.h" |
+ |
+#include "android_webview/native/aw_contents.h" |
+#include "base/bind.h" |
+#include "base/callback.h" |
+#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/render_view_host.h" |
+#include "content/public/browser/web_contents.h" |
+#include "googleurl/src/gurl.h" |
+ |
+namespace android_webview { |
+ |
+AwGeolocationPermissionContext::~AwGeolocationPermissionContext() { |
+} |
+ |
+void AwGeolocationPermissionContext::RequestGeolocationPermission( |
+ int render_process_id, |
+ int render_view_id, |
+ int bridge_id, |
+ const GURL& requesting_frame, |
+ base::Callback<void(bool)> callback) { |
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
boliu_use_chromium_pls
2013/01/04 23:45:43
I know the chrome implementation has this check, b
Kristian Monsen
2013/01/05 02:44:58
Done.
|
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, |
+ base::Bind( |
+ &AwGeolocationPermissionContext::RequestGeolocationPermission, |
+ this, render_process_id, render_view_id, bridge_id, |
+ requesting_frame, callback)); |
+ return; |
+ } |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ |
+ const content::RenderViewHost* host = |
+ content::RenderViewHost::FromID(render_process_id, render_view_id); |
+ content::WebContents* webContents = |
+ content::WebContents::FromRenderViewHost(host); |
+ AwContents* awContents = AwContents::FromWebContents(webContents); |
+ awContents->GeolocationShowPrompt( |
+ render_process_id, |
+ render_view_id, |
+ bridge_id, |
+ requesting_frame); |
+} |
+ |
+// static |
+content::GeolocationPermissionContext* |
+AwGeolocationPermissionContext::Create() { |
+ return new AwGeolocationPermissionContext(); |
+} |
+ |
+void AwGeolocationPermissionContext::CancelGeolocationPermissionRequest( |
+ int render_process_id, |
+ int render_view_id, |
+ int bridge_id, |
+ const GURL& requesting_frame) { |
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
boliu_use_chromium_pls
2013/01/04 23:45:43
ditto
Kristian Monsen
2013/01/05 02:44:58
Done.
|
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, |
+ base::Bind( |
+ &AwGeolocationPermissionContext:: |
+ CancelGeolocationPermissionRequest, |
+ this, render_process_id, render_view_id, bridge_id, |
+ requesting_frame |
+ )); |
+ return; |
+ } |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ // TODO(kristianm): Implement this |
+} |
+ |
+void InvokeCallback( |
+ int render_process_id, |
+ int render_view_id, |
+ int bridge_id, |
+ const GURL& requesting_frame, |
+ bool value) { |
+} |
+ |
+} // namespace android_webview |