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

Unified Diff: android_webview/native/aw_geolocation_permission_context.cc

Issue 12211047: Implementing geolocation for the Android Webview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style updates Created 7 years, 10 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
index 959c4647c54dfeeb6fe5201466b3f1057f59fb63..abd1666d889e43e0959a33229cf05418ba6c3474 100644
--- a/android_webview/native/aw_geolocation_permission_context.cc
+++ b/android_webview/native/aw_geolocation_permission_context.cc
@@ -10,7 +10,6 @@
#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 {
@@ -25,16 +24,28 @@ AwGeolocationPermissionContext::RequestGeolocationPermissionOnUIThread(
const GURL& requesting_frame,
base::Callback<void(bool)> callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- const content::RenderViewHost* host =
+
+ const content::RenderViewHost* rvh =
boliu 2013/02/06 20:29:54 Is this id->AwContents code duplicated with Selim'
Kristian Monsen 2013/02/08 00:07:44 Coordinating with Selim, will use that before land
content::RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!rvh) {
+ callback.Run(false);
+ return;
+ }
+
content::WebContents* web_contents =
- content::WebContents::FromRenderViewHost(host);
+ content::WebContents::FromRenderViewHost(rvh);
+ if (!web_contents) {
+ callback.Run(false);
+ return;
+ }
+
AwContents* aw_contents = AwContents::FromWebContents(web_contents);
- aw_contents->OnGeolocationShowPrompt(
- render_process_id,
- render_view_id,
- bridge_id,
- requesting_frame);
+ if (!aw_contents) {
+ callback.Run(false);
+ return;
+ }
joth 2013/02/06 22:09:51 yeah, this will all be cleaner with a method facto
Kristian Monsen 2013/02/08 00:07:44 Done.
+
+ aw_contents->OnGeolocationShowPrompt(requesting_frame, callback);
}
void
@@ -70,7 +81,23 @@ AwGeolocationPermissionContext::CancelGeolocationPermissionRequestOnUIThread(
int bridge_id,
const GURL& requesting_frame) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- // TODO(kristianm): Implement this
+
+ const content::RenderViewHost* rvh =
boliu 2013/02/06 20:29:54 Certainly don't duplicate this logic twice in the
Kristian Monsen 2013/02/08 00:07:44 Done.
+ content::RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!rvh) {
+ return;
+ }
+
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderViewHost(rvh);
+ if (!web_contents) {
+ return;
+ }
+
+ AwContents* aw_contents = AwContents::FromWebContents(web_contents);
+ if (aw_contents) {
+ aw_contents->OnGeolocationHidePrompt(requesting_frame);
+ }
}
void
@@ -91,13 +118,4 @@ AwGeolocationPermissionContext::CancelGeolocationPermissionRequest(
requesting_frame));
}
-void InvokeCallback(
- int render_process_id,
- int render_view_id,
- int bridge_id,
- const GURL& requesting_frame,
- bool value) {
- // TODO(kristianm): Implement this
-}
-
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698