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 "chrome/browser/geolocation/chrome_geolocation_permission_context_andro id.h" | |
6 | |
7 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller_androi d.h" | |
8 #include "chrome/browser/prefs/pref_service.h" | |
9 #include "chrome/browser/profiles/profile.h" | |
10 #include "chrome/common/pref_names.h" | |
11 #include "content/public/browser/browser_thread.h" | |
12 | |
13 ChromeGeolocationPermissionContext* ChromeGeolocationPermissionContext::Create( | |
14 Profile *profile) { | |
bulach
2012/10/17 13:17:38
nit: s/Profile *p/Profile* p/
Ramya
2012/10/17 21:43:31
Done.
| |
15 return new ChromeGeolocationPermissionContextAndroid(profile); | |
16 } | |
17 | |
18 void ChromeGeolocationPermissionContext::RegisterUserPrefs( | |
19 PrefService *user_prefs) { | |
bulach
2012/10/17 13:17:38
nit: s/PrefService *u/PrefService* u/
Ramya
2012/10/17 21:43:31
Done.
| |
20 user_prefs->RegisterBooleanPref(prefs::kGeolocationEnabled, | |
21 true, | |
22 PrefService::UNSYNCABLE_PREF); | |
23 } | |
24 | |
25 ChromeGeolocationPermissionContextAndroid:: | |
26 ChromeGeolocationPermissionContextAndroid(Profile* profile) | |
27 : ChromeGeolocationPermissionContext(profile) { | |
28 } | |
29 | |
30 void ChromeGeolocationPermissionContextAndroid::DecidePermission( | |
31 int render_process_id, | |
32 int render_view_id, | |
33 int bridge_id, | |
34 const GURL& requesting_frame, | |
35 const GURL& embedder, | |
36 base::Callback<void(bool)> callback) { | |
37 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
38 | |
39 // Check to see if the feature in its entirety has been disabled. | |
40 // This must happen before other services (e.g. tabs, extensions) | |
41 // get an opportunity to allow the geolocation request. | |
42 if (!profile()->GetPrefs()->GetBoolean(prefs::kGeolocationEnabled)) { | |
43 PermissionDecided(render_process_id, render_view_id, bridge_id, | |
44 requesting_frame, embedder, callback, false); | |
45 return; | |
46 } | |
47 | |
48 ChromeGeolocationPermissionContext::DecidePermission( | |
49 render_process_id, render_view_id, bridge_id, | |
50 requesting_frame, embedder, callback); | |
51 } | |
52 | |
53 void ChromeGeolocationPermissionContextAndroid::PermissionDecided( | |
54 int render_process_id, | |
55 int render_view_id, | |
56 int bridge_id, | |
57 const GURL& requesting_frame, | |
58 const GURL& embedder, | |
59 base::Callback<void(bool)> callback, | |
60 bool allowed) { | |
61 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
62 ChromeGeolocationPermissionContextAndroid::PermissionDecided( | |
bulach
2012/10/17 13:17:38
this seems recursive :) probably remove 53-65 alto
Ramya
2012/10/17 21:43:31
Done.
| |
63 render_process_id, render_view_id, bridge_id, | |
64 requesting_frame, embedder, callback, true); | |
65 } | |
66 | |
67 GeolocationInfoBarQueueController* | |
68 ChromeGeolocationPermissionContextAndroid::CreateQueueController() { | |
69 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
70 return new GeolocationInfoBarQueueControllerAndroid( | |
71 profile()); | |
72 } | |
OLD | NEW |