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

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context_android.h

Issue 815343005: Clean up geolocation code now that it's all upstream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renamed IsSystemLocationEnabled -> IsLocationEnabled Created 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
7 7
8 // The flow for geolocation permissions on Android needs to take into account 8 // The flow for geolocation permissions on Android needs to take into account
9 // the global geolocation settings so it differs from the desktop one. It 9 // the global geolocation settings so it differs from the desktop one. It
10 // works as follows. 10 // works as follows.
11 // GeolocationPermissionContextAndroid::RequestPermission intercepts the flow 11 // GeolocationPermissionContextAndroid::RequestPermission intercepts the flow
12 // and proceeds to check the system location. 12 // and proceeds to check the system location.
13 // This will in fact check several possible settings 13 // This will in fact check several possible settings
14 // - The global system geolocation setting 14 // - The global system geolocation setting
15 // - The Google location settings on pre KK devices 15 // - The Google location settings on pre KK devices
16 // - An old internal Chrome setting on pre-JB MR1 devices 16 // - An old internal Chrome setting on pre-JB MR1 devices
17 // With all that information it will decide if system location is enabled. 17 // With all that information it will decide if system location is enabled.
18 // If enabled, it proceeds with the per site flow via 18 // If enabled, it proceeds with the per site flow via
19 // GeolocationPermissionContext (which will check per site permissions, create 19 // GeolocationPermissionContext (which will check per site permissions, create
20 // infobars, etc.). 20 // infobars, etc.).
21 // 21 //
22 // Otherwise the permission is already decided. 22 // Otherwise the permission is already decided.
23 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
24 #include "chrome/browser/geolocation/geolocation_permission_context.h" 24 #include "chrome/browser/geolocation/geolocation_permission_context.h"
25 25
26 namespace content { 26 namespace content {
27 class WebContents; 27 class WebContents;
28 } 28 }
29 29
30 class GoogleLocationSettingsHelper; 30 class LocationSettings;
31 class GURL; 31 class GURL;
32 class PermissionRequestID; 32 class PermissionRequestID;
33 33
34 class GeolocationPermissionContextAndroid 34 class GeolocationPermissionContextAndroid
35 : public GeolocationPermissionContext { 35 : public GeolocationPermissionContext {
36 public: 36 public:
37 explicit GeolocationPermissionContextAndroid(Profile* profile); 37 explicit GeolocationPermissionContextAndroid(Profile* profile);
38 ~GeolocationPermissionContextAndroid() override; 38 ~GeolocationPermissionContextAndroid() override;
39 39
40 private: 40 private:
41 friend class GeolocationPermissionContextTests; 41 friend class GeolocationPermissionContextTests;
42 42
43 // GeolocationPermissionContext: 43 // GeolocationPermissionContext:
44 void RequestPermission( 44 void RequestPermission(
45 content::WebContents* web_contents, 45 content::WebContents* web_contents,
46 const PermissionRequestID& id, 46 const PermissionRequestID& id,
47 const GURL& requesting_frame_origin, 47 const GURL& requesting_frame_origin,
48 bool user_gesture, 48 bool user_gesture,
49 const BrowserPermissionCallback& callback) override; 49 const BrowserPermissionCallback& callback) override;
50 50
51 // Overrides the GoogleLocationSettingsHelper used to determine whether 51 // Overrides the LocationSettings object used to determine whether
52 // system and Chrome-wide location permissions are enabled. 52 // system and Chrome-wide location permissions are enabled.
53 void SetGoogleLocationSettingsHelperForTesting( 53 void SetLocationSettingsForTesting(scoped_ptr<LocationSettings> settings);
54 scoped_ptr<GoogleLocationSettingsHelper> helper);
55 54
56 scoped_ptr<GoogleLocationSettingsHelper> google_location_settings_helper_; 55 scoped_ptr<LocationSettings> location_settings_;
57 56
58 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); 57 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid);
59 }; 58 };
60 59
61 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ 60 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/mock_location_settings.cc ('k') | chrome/browser/geolocation/geolocation_permission_context_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698