| OLD | NEW |
| 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::DecidePermission intercepts the flow in | 11 // GeolocationPermissionContextAndroid::DecidePermission intercepts the flow in |
| 12 // the UI thread, and posts a task to the blocking pool to CheckSystemLocation. | 12 // the UI thread, and posts a task to the blocking pool to CheckSystemLocation. |
| 13 // CheckSystemLocation will in fact check several possible settings | 13 // CheckSystemLocation 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 | 23 |
| 24 // There is a bit of thread jumping since some of the permissions (like the | 24 // There is a bit of thread jumping since some of the permissions (like the |
| 25 // per site settings) are queried on the UI thread while the system level | 25 // per site settings) are queried on the UI thread while the system level |
| 26 // permissions are considered I/O and thus checked in the blocking thread pool. | 26 // permissions are considered I/O and thus checked in the blocking thread pool. |
| 27 | 27 |
| 28 #include "chrome/browser/content_settings/permission_request_id.h" | |
| 29 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 28 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 29 #include "components/content_settings/core/common/permission_request_id.h" |
| 30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 class WebContents; | 33 class WebContents; |
| 34 } | 34 } |
| 35 | 35 |
| 36 class GoogleLocationSettingsHelper; | 36 class GoogleLocationSettingsHelper; |
| 37 | 37 |
| 38 | 38 |
| 39 class GeolocationPermissionContextAndroid | 39 class GeolocationPermissionContextAndroid |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 void CheckSystemLocation(content::WebContents* web_contents, | 73 void CheckSystemLocation(content::WebContents* web_contents, |
| 74 const PermissionRequestInfo& info, | 74 const PermissionRequestInfo& info, |
| 75 base::Callback<void(bool)> callback); | 75 base::Callback<void(bool)> callback); |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); | 77 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ | 80 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ |
| OLD | NEW |