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

Side by Side 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: Fixing clang errors 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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* web_contents =
31 content::WebContents::FromRenderViewHost(host);
32 AwContents* aw_contents = AwContents::FromWebContents(web_contents);
33 aw_contents->OnGeolocationShowPrompt(
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) {
100 // TODO(kristianm): Implement this
101 }
102
103 } // namespace android_webview
OLDNEW
« 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