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

Unified Diff: chrome/browser/geolocation/geolocation_permission_context_android.h

Issue 441883003: Simplify Android geolocation permission checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/geolocation_permission_context_android.h
diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.h b/chrome/browser/geolocation/geolocation_permission_context_android.h
index 24337f9cd6ecaf5997d16c598bd5d0bf5671dd0e..6af10e61ff6c1d4c765d79c3b38c8c838c4f3bf3 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_android.h
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.h
@@ -1,10 +1,30 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
+// The flow for geolocation permissions on Android needs to take into account
+// the global geolocation settings so it differs from the desktop one. It
+// works as follows.
+// GeolocationPermissionContextAndroid::DecidePermission intercepts the flow in
+// the UI thread, and posts a task to the blocking pool to CheckSystemLocation.
+// CheckSystemLocation will in fact check several possible settings
+// - The global system geolocation setting
+// - The Google location settings on pre KK devices
+// - An old internal Chrome setting on pre-JB MR1 devices
+// With all that information it will decide if system location is enabled.
+// If enabled, it proceeds with the per site flow via
+// GeolocationPermissionContext (which will check per site permissions, create
+// infobars, etc.).
+//
+// Otherwise the permission is already decided.
+
+// There is a bit of thread jumping since some of the permissions (like the
+// per site settings) are queried on the UI thread while the system level
+// permissions are considered I/O and thus checked in the blocking thread pool.
+
#include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include "url/gurl.h"
@@ -15,8 +35,7 @@ class WebContents;
class GoogleLocationSettingsHelper;
-// Android-specific geolocation permission flow, taking into account the
-// Google Location Settings, if available.
+
class GeolocationPermissionContextAndroid
: public GeolocationPermissionContext {
public:
@@ -42,24 +61,16 @@ class GeolocationPermissionContextAndroid
const GURL& requesting_frame,
bool user_gesture,
const GURL& embedder,
- const std::string& accept_button_label,
base::Callback<void(bool)> callback) OVERRIDE;
- virtual void PermissionDecided(const PermissionRequestID& id,
- const GURL& requesting_frame,
- const GURL& embedder,
- base::Callback<void(bool)> callback,
- bool allowed) OVERRIDE;
-
void ProceedDecidePermission(content::WebContents* web_contents,
const PermissionRequestInfo& info,
- const std::string& accept_button_label,
base::Callback<void(bool)> callback);
scoped_ptr<GoogleLocationSettingsHelper> google_location_settings_helper_;
private:
- void CheckMasterLocation(content::WebContents* web_contents,
+ void CheckSystemLocation(content::WebContents* web_contents,
const PermissionRequestInfo& info,
base::Callback<void(bool)> callback);

Powered by Google App Engine
This is Rietveld 408576698