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

Side by Side Diff: chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc

Issue 11186010: Update geolocation infobar to handle Android system settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Failed to upload Created 8 years, 1 month 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_andro id.h" 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_andro id.h"
6 6
7 #include "chrome/browser/android/google_location_settings_helper.h"
7 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
10 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
11 12
12 ChromeGeolocationPermissionContextAndroid:: 13 ChromeGeolocationPermissionContextAndroid::
13 ChromeGeolocationPermissionContextAndroid(Profile* profile) 14 ChromeGeolocationPermissionContextAndroid(Profile* profile)
14 : ChromeGeolocationPermissionContext(profile) { 15 : ChromeGeolocationPermissionContext(profile),
16 google_location_settings_helper_(new GoogleLocationSettingsHelper()) {
15 } 17 }
16 18
17 ChromeGeolocationPermissionContextAndroid:: 19 ChromeGeolocationPermissionContextAndroid::
18 ~ChromeGeolocationPermissionContextAndroid() { 20 ~ChromeGeolocationPermissionContextAndroid() {
19 } 21 }
20 22
21 void ChromeGeolocationPermissionContextAndroid::DecidePermission( 23 void ChromeGeolocationPermissionContextAndroid::DecidePermission(
22 int render_process_id, 24 int render_process_id,
23 int render_view_id, 25 int render_view_id,
24 int bridge_id, 26 int bridge_id,
25 const GURL& requesting_frame, 27 const GURL& requesting_frame,
26 const GURL& embedder, 28 const GURL& embedder,
27 base::Callback<void(bool)> callback) { 29 base::Callback<void(bool)> callback) {
28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 30 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
29 31
30 // Check to see if the feature in its entirety has been disabled. 32 // Check to see if the feature in its entirety has been disabled.
31 // This must happen before other services (e.g. tabs, extensions) 33 // This must happen before other services (e.g. tabs, extensions)
32 // get an opportunity to allow the geolocation request. 34 // get an opportunity to allow the geolocation request.
33 if (!profile()->GetPrefs()->GetBoolean(prefs::kGeolocationEnabled)) { 35 if (!google_location_settings_helper_->IsMasterLocationSettingEnabled()) {
34 PermissionDecided(render_process_id, render_view_id, bridge_id, 36 PermissionDecided(render_process_id, render_view_id, bridge_id,
35 requesting_frame, embedder, callback, false); 37 requesting_frame, embedder, callback, false);
36 return; 38 return;
37 } 39 }
38 40
39 ChromeGeolocationPermissionContext::DecidePermission( 41 ChromeGeolocationPermissionContext::DecidePermission(
40 render_process_id, render_view_id, bridge_id, 42 render_process_id, render_view_id, bridge_id,
41 requesting_frame, embedder, callback); 43 requesting_frame, embedder, callback);
42 } 44 }
45
46 void ChromeGeolocationPermissionContextAndroid::PermissionDecided(
47 int render_process_id,
48 int render_view_id,
49 int bridge_id,
50 const GURL& requesting_frame,
51 const GURL& embedder,
52 base::Callback<void(bool)> callback,
53 bool allowed) {
54 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
55 // If Google Apps Location setting is turned off then we ignore
56 // the 'allow' website setting for this site and instead show
57 // the infobar to go back to the 'settings' to turn it back on.
58 if (allowed &&
59 !google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled()) {
60 QueueController()->CreateInfoBarRequest(
61 render_process_id, render_view_id, bridge_id, requesting_frame,
62 embedder, callback);
63 return;
64 }
65
66 ChromeGeolocationPermissionContext::PermissionDecided(
67 render_process_id, render_view_id, bridge_id,
68 requesting_frame, embedder, callback, allowed);
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698