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 const content::RenderViewHost* host = | |
boliu
2013/01/05 04:37:35
DCHECK for ui thread
Kristian Monsen
2013/01/05 04:54:40
Done. Added to the other one as well.
| |
28 content::RenderViewHost::FromID(render_process_id, render_view_id); | |
29 content::WebContents* webContents = | |
30 content::WebContents::FromRenderViewHost(host); | |
31 AwContents* awContents = AwContents::FromWebContents(webContents); | |
32 awContents->GeolocationShowPrompt( | |
33 render_process_id, | |
34 render_view_id, | |
35 bridge_id, | |
36 requesting_frame); | |
37 } | |
38 | |
39 void | |
40 AwGeolocationPermissionContext::RequestGeolocationPermission( | |
41 int render_process_id, | |
42 int render_view_id, | |
43 int bridge_id, | |
44 const GURL& requesting_frame, | |
45 base::Callback<void(bool)> callback) { | |
46 content::BrowserThread::PostTask( | |
47 content::BrowserThread::UI, FROM_HERE, | |
48 base::Bind( | |
49 &AwGeolocationPermissionContext:: | |
50 RequestGeolocationPermissionOnUIThread, | |
51 this, | |
52 render_process_id, | |
53 render_view_id, | |
54 bridge_id, | |
55 requesting_frame, | |
56 callback)); | |
57 } | |
58 | |
59 // static | |
60 content::GeolocationPermissionContext* | |
61 AwGeolocationPermissionContext::Create() { | |
62 return new AwGeolocationPermissionContext(); | |
63 } | |
64 | |
65 void | |
66 AwGeolocationPermissionContext::CancelGeolocationPermissionRequestOnUIThread( | |
67 int render_process_id, | |
68 int render_view_id, | |
69 int bridge_id, | |
70 const GURL& requesting_frame) { | |
71 // TODO(kristianm): Implement this | |
72 } | |
73 | |
74 void | |
75 AwGeolocationPermissionContext::CancelGeolocationPermissionRequest( | |
76 int render_process_id, | |
77 int render_view_id, | |
78 int bridge_id, | |
79 const GURL& requesting_frame) { | |
80 content::BrowserThread::PostTask( | |
81 content::BrowserThread::UI, FROM_HERE, | |
82 base::Bind( | |
83 &AwGeolocationPermissionContext:: | |
84 CancelGeolocationPermissionRequestOnUIThread, | |
85 this, | |
86 render_process_id, | |
87 render_view_id, | |
88 bridge_id, | |
89 requesting_frame | |
90 )); | |
boliu
2013/01/05 04:37:35
this go on end of previous line
Kristian Monsen
2013/01/05 04:54:40
Done.
| |
91 } | |
92 | |
93 void InvokeCallback( | |
94 int render_process_id, | |
95 int render_view_id, | |
96 int bridge_id, | |
97 const GURL& requesting_frame, | |
98 bool value) { | |
99 } | |
100 | |
101 } // namespace android_webview | |
OLD | NEW |