[cros new GAIA] Update GAIA card size
[chromium-blink-merge.git] / chrome / browser / geolocation / geolocation_permission_context_android.h
blobdb24bfbe2d1cf1ff7322c05c8ca44ae4725932d5
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
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
10 // works as follows.
11 // GeolocationPermissionContextAndroid::RequestPermission intercepts the flow
12 // and proceeds to check the system location.
13 // This will in fact check several possible settings
14 // - The global system geolocation setting
15 // - The Google location settings on pre KK 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.
18 // If enabled, it proceeds with the per site flow via
19 // GeolocationPermissionContext (which will check per site permissions, create
20 // infobars, etc.).
22 // Otherwise the permission is already decided.
23 #include "base/memory/scoped_ptr.h"
24 #include "chrome/browser/geolocation/geolocation_permission_context.h"
26 namespace content {
27 class WebContents;
30 class LocationSettings;
31 class GURL;
32 class PermissionRequestID;
34 class GeolocationPermissionContextAndroid
35 : public GeolocationPermissionContext {
36 public:
37 explicit GeolocationPermissionContextAndroid(Profile* profile);
38 ~GeolocationPermissionContextAndroid() override;
40 private:
41 friend class GeolocationPermissionContextTests;
43 // GeolocationPermissionContext:
44 void RequestPermission(
45 content::WebContents* web_contents,
46 const PermissionRequestID& id,
47 const GURL& requesting_frame_origin,
48 bool user_gesture,
49 const BrowserPermissionCallback& callback) override;
51 // Overrides the LocationSettings object used to determine whether
52 // system and Chrome-wide location permissions are enabled.
53 void SetLocationSettingsForTesting(scoped_ptr<LocationSettings> settings);
55 scoped_ptr<LocationSettings> location_settings_;
57 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid);
60 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_