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 #include "googleurl/src/gurl.h" | |
14 | |
15 namespace android_webview { | |
16 | |
17 AwGeolocationPermissionContext::~AwGeolocationPermissionContext() { | |
18 } | |
19 | |
20 void | |
21 AwGeolocationPermissionContext::RequestGeolocationPermissionOnUIThread( | |
22 int render_process_id, | |
23 int render_view_id, | |
24 int bridge_id, | |
25 const GURL& requesting_frame, | |
26 base::Callback<void(bool)> callback) { | |
27 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
28 const content::RenderViewHost* host = | |
29 content::RenderViewHost::FromID(render_process_id, render_view_id); | |
30 content::WebContents* webContents = | |
benm (inactive)
2013/01/07 10:45:02
nit: web_contents
Kristian Monsen
2013/01/07 18:41:09
Done.
| |
31 content::WebContents::FromRenderViewHost(host); | |
32 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.
| |
33 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
| |
34 render_process_id, | |
35 render_view_id, | |
36 bridge_id, | |
37 requesting_frame); | |
38 } | |
39 | |
40 void | |
41 AwGeolocationPermissionContext::RequestGeolocationPermission( | |
42 int render_process_id, | |
43 int render_view_id, | |
44 int bridge_id, | |
45 const GURL& requesting_frame, | |
46 base::Callback<void(bool)> callback) { | |
47 content::BrowserThread::PostTask( | |
48 content::BrowserThread::UI, FROM_HERE, | |
49 base::Bind( | |
50 &AwGeolocationPermissionContext:: | |
51 RequestGeolocationPermissionOnUIThread, | |
52 this, | |
53 render_process_id, | |
54 render_view_id, | |
55 bridge_id, | |
56 requesting_frame, | |
57 callback)); | |
58 } | |
59 | |
60 // static | |
61 content::GeolocationPermissionContext* | |
62 AwGeolocationPermissionContext::Create() { | |
63 return new AwGeolocationPermissionContext(); | |
64 } | |
65 | |
66 void | |
67 AwGeolocationPermissionContext::CancelGeolocationPermissionRequestOnUIThread( | |
68 int render_process_id, | |
69 int render_view_id, | |
70 int bridge_id, | |
71 const GURL& requesting_frame) { | |
72 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
73 // TODO(kristianm): Implement this | |
74 } | |
75 | |
76 void | |
77 AwGeolocationPermissionContext::CancelGeolocationPermissionRequest( | |
78 int render_process_id, | |
79 int render_view_id, | |
80 int bridge_id, | |
81 const GURL& requesting_frame) { | |
82 content::BrowserThread::PostTask( | |
83 content::BrowserThread::UI, FROM_HERE, | |
84 base::Bind( | |
85 &AwGeolocationPermissionContext:: | |
86 CancelGeolocationPermissionRequestOnUIThread, | |
87 this, | |
88 render_process_id, | |
89 render_view_id, | |
90 bridge_id, | |
91 requesting_frame)); | |
92 } | |
93 | |
94 void InvokeCallback( | |
95 int render_process_id, | |
96 int render_view_id, | |
97 int bridge_id, | |
98 const GURL& requesting_frame, | |
99 bool value) { | |
benm (inactive)
2013/01/07 10:45:02
nit: TODO?
Kristian Monsen
2013/01/08 08:03:10
Done.
| |
100 } | |
101 | |
102 } // namespace android_webview | |
OLD | NEW |