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

Unified Diff: android_webview/native/aw_geolocation_permission_context.cc

Issue 11763002: Implementing native chromium GeolocationPermissionContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small corrections Created 7 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: 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..1d96fbd4e4815e19b87b1570f85c310aed9a61c9
--- /dev/null
+++ b/android_webview/native/aw_geolocation_permission_context.cc
@@ -0,0 +1,102 @@
+// 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::RequestGeolocationPermissionOnUIThread(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ const content::RenderViewHost* host =
+ content::RenderViewHost::FromID(render_process_id, render_view_id);
+ content::WebContents* webContents =
benm (inactive) 2013/01/07 10:45:02 nit: web_contents
Kristian Monsen 2013/01/07 18:41:09 Done.
+ content::WebContents::FromRenderViewHost(host);
+ AwContents* awContents = AwContents::FromWebContents(webContents);
benm (inactive) 2013/01/07 10:45:02 nit: aw_contents
Kristian Monsen 2013/01/07 18:41:09 Done.
+ awContents->GeolocationShowPrompt(
benm (inactive) 2013/01/07 10:45:02 would ShowGeolocationPrompt be more readable?
Kristian Monsen 2013/01/07 18:41:09 Public API is onGeolocationPermissionsShowPrompt:
joth 2013/01/07 20:25:15 Yep - onFoo in chromium is normally kept for Foo I
Kristian Monsen 2013/01/08 08:03:10 Added On prefix
+ render_process_id,
+ render_view_id,
+ bridge_id,
+ requesting_frame);
+}
+
+void
+AwGeolocationPermissionContext::RequestGeolocationPermission(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(
+ &AwGeolocationPermissionContext::
+ RequestGeolocationPermissionOnUIThread,
+ this,
+ render_process_id,
+ render_view_id,
+ bridge_id,
+ requesting_frame,
+ callback));
+}
+
+// static
+content::GeolocationPermissionContext*
+AwGeolocationPermissionContext::Create() {
+ return new AwGeolocationPermissionContext();
+}
+
+void
+AwGeolocationPermissionContext::CancelGeolocationPermissionRequestOnUIThread(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ // TODO(kristianm): Implement this
+}
+
+void
+AwGeolocationPermissionContext::CancelGeolocationPermissionRequest(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(
+ &AwGeolocationPermissionContext::
+ CancelGeolocationPermissionRequestOnUIThread,
+ this,
+ render_process_id,
+ render_view_id,
+ bridge_id,
+ requesting_frame));
+}
+
+void InvokeCallback(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool value) {
benm (inactive) 2013/01/07 10:45:02 nit: TODO?
Kristian Monsen 2013/01/08 08:03:10 Done.
+}
+
+} // namespace android_webview
« no previous file with comments | « android_webview/native/aw_geolocation_permission_context.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698