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

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

Issue 852593002: Allow overriding GoogleLocationSettingsHelper for tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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 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 ea02ca6e7c559495e9c672a5f8d3ec676e8fd1fe..762e229bd3a959d57b69f521be6fa3797db09a22 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_android.h
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.h
@@ -25,6 +25,10 @@
// 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.
+// TODO(newt): investigate the comment above about threading. AFAICT, system
+// level permission checks actually happen on the UI thread, though they jump
+// through the IO thread unnecessarily. This should be fixed.
+
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/geolocation/geolocation_permission_context.h"
@@ -41,9 +45,11 @@ class GeolocationPermissionContextAndroid
: public GeolocationPermissionContext {
public:
explicit GeolocationPermissionContextAndroid(Profile* profile);
- virtual ~GeolocationPermissionContextAndroid();
+ ~GeolocationPermissionContextAndroid() override;
private:
+ friend class GeolocationPermissionContextTests;
+
struct PermissionRequestInfo {
PermissionRequestInfo();
@@ -54,7 +60,7 @@ class GeolocationPermissionContextAndroid
};
// PermissionContextBase:
- virtual void RequestPermission(
+ void RequestPermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame_origin,
@@ -74,6 +80,11 @@ class GeolocationPermissionContextAndroid
void InterceptPermissionCheck(const BrowserPermissionCallback& callback,
bool granted);
+ // Overrides the GoogleLocationSettingsHelper used to determine whether
+ // system and Chrome-wide location permissions are enabled.
+ void SetGoogleLocationSettingsHelperForTesting(
+ scoped_ptr<GoogleLocationSettingsHelper> helper);
+
scoped_ptr<GoogleLocationSettingsHelper> google_location_settings_helper_;
base::WeakPtrFactory<GeolocationPermissionContextAndroid> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698