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

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: Different static cast 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 AwGeolocationPermissionContext::RequestGeolocationPermission(
21 int render_process_id,
22 int render_view_id,
23 int bridge_id,
24 const GURL& requesting_frame,
25 base::Callback<void(bool)> callback) {
26 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
27 content::BrowserThread::PostTask(
28 content::BrowserThread::UI, FROM_HERE,
29 base::Bind(
30 &AwGeolocationPermissionContext::RequestGeolocationPermission,
31 this, render_process_id, render_view_id, bridge_id,
32 requesting_frame, callback));
33 return;
34 }
35 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
36
37 const content::RenderViewHost* host =
38 content::RenderViewHost::FromID(render_process_id, render_view_id);
39 content::WebContents* webContents =
40 content::WebContents::FromRenderViewHost(host);
41 AwContents* awContents = AwContents::FromWebContents(webContents);
42 awContents->GeolocationShowPrompt(
43 render_process_id,
44 render_view_id,
45 bridge_id,
46 requesting_frame);
47 }
48
49 void AwGeolocationPermissionContext::CancelGeolocationPermissionRequest(
50 int render_process_id,
51 int render_view_id,
52 int bridge_id,
53 const GURL& requesting_frame) {
54 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
55 content::BrowserThread::PostTask(
56 content::BrowserThread::UI, FROM_HERE,
57 base::Bind(
58 &AwGeolocationPermissionContext::
59 CancelGeolocationPermissionRequest,
60 this, render_process_id, render_view_id, bridge_id,
61 requesting_frame
62 ));
63 return;
64 }
65 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
66 // TODO(kristianm): Implement this
67 }
68
69 void InvokeCallback(
70 int render_process_id,
71 int render_view_id,
72 int bridge_id,
73 const GURL& requesting_frame,
74 bool value) {
75 }
76
77 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698