Chromium Code Reviews| 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 |