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

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: Using factory function ptr instead of passing object 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)) {
boliu_use_chromium_pls 2013/01/04 23:45:43 I know the chrome implementation has this check, b
Kristian Monsen 2013/01/05 02:44:58 Done.
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 // static
50 content::GeolocationPermissionContext*
51 AwGeolocationPermissionContext::Create() {
52 return new AwGeolocationPermissionContext();
53 }
54
55 void AwGeolocationPermissionContext::CancelGeolocationPermissionRequest(
56 int render_process_id,
57 int render_view_id,
58 int bridge_id,
59 const GURL& requesting_frame) {
60 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
boliu_use_chromium_pls 2013/01/04 23:45:43 ditto
Kristian Monsen 2013/01/05 02:44:58 Done.
61 content::BrowserThread::PostTask(
62 content::BrowserThread::UI, FROM_HERE,
63 base::Bind(
64 &AwGeolocationPermissionContext::
65 CancelGeolocationPermissionRequest,
66 this, render_process_id, render_view_id, bridge_id,
67 requesting_frame
68 ));
69 return;
70 }
71 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
72 // TODO(kristianm): Implement this
73 }
74
75 void InvokeCallback(
76 int render_process_id,
77 int render_view_id,
78 int bridge_id,
79 const GURL& requesting_frame,
80 bool value) {
81 }
82
83 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698