diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 13:19:57 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 13:19:57 +0000 |
commit | 6e14e4f148f308917dc5de8b09e6307e851a39a1 (patch) | |
tree | 5e162017ee13a1cfc35fc38372c09eebab086517 /chrome/browser/geolocation/geolocation_permission_context.h | |
parent | 8bc90e59bad05168abc098d6068df109a650a011 (diff) | |
download | chromium_src-6e14e4f148f308917dc5de8b09e6307e851a39a1.zip chromium_src-6e14e4f148f308917dc5de8b09e6307e851a39a1.tar.gz chromium_src-6e14e4f148f308917dc5de8b09e6307e851a39a1.tar.bz2 |
Uses GURL instead of host for requesting Geolocation permission.
Tidy up GeolocationPermissionContext.
(in preparation for http://codereview.chromium.org/1033004).
Review URL: http://codereview.chromium.org/1074004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/geolocation_permission_context.h')
-rw-r--r-- | chrome/browser/geolocation/geolocation_permission_context.h | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/chrome/browser/geolocation/geolocation_permission_context.h b/chrome/browser/geolocation/geolocation_permission_context.h index 6b79fd75..6e387f1 100644 --- a/chrome/browser/geolocation/geolocation_permission_context.h +++ b/chrome/browser/geolocation/geolocation_permission_context.h @@ -11,15 +11,14 @@ #include "base/ref_counted.h" class GeolocationDispatcherHost; +class GURL; class Profile; class RenderViewHost; -// GeolocationPermissionContext manages Geolocation permissions per host. -// It keeps an in-memory cache of permissions, and if not available, loads -// from disk. If there's no data, it'll trigger the UI elements to ask the -// user for permission. -// Regardless of where the permission data came from, it always notifies the -// requesting render_view asynchronously via ViewMsg_Geolocation_PermissionSet. +// GeolocationPermissionContext manages Geolocation permissions flow, +// creating UI elements to ask the user for permission when necessary. +// It always notifies the requesting render_view asynchronously via +// ViewMsg_Geolocation_PermissionSet. class GeolocationPermissionContext : public base::RefCountedThreadSafe<GeolocationPermissionContext> { public: @@ -30,36 +29,22 @@ class GeolocationPermissionContext // Must be called from the IO thread. void RequestGeolocationPermission( int render_process_id, int render_view_id, int bridge_id, - const std::string& host); + const GURL& requesting_frame); // Called once the user sets the geolocation permission. - // It'll update the internal state on different threads via - // SetPermissionMemoryCacheOnIOThread and SetPermissionOnFileThread. + // It'll notify the render via ViewMsg_Geolocation_PermissionSet. void SetPermission( int render_process_id, int render_view_id, int bridge_id, - const std::string& host, bool allowed); + const GURL& requesting_frame, bool allowed); private: friend class base::RefCountedThreadSafe<GeolocationPermissionContext>; virtual ~GeolocationPermissionContext(); - // This is initially called on the IO thread by the public API - // RequestGeolocationPermission when there's no data available in the - // in-memory cache. - // It forwards a call to the FILE thread which tries to load permission data - // from disk: - // - If available, it will call SetPermissionMemoryCacheOnIOThread() to write - // the in-memory cache in the IO thread, and NotifyPermissionSet to send the - // message to the corresponding render. - // - If not available, it'll delegate to RequestPermissionDataFromUI. - void HandlePermissionMemoryCacheMiss( - int render_process_id, int render_view_id, int bridge_id, - const std::string& host); - // Triggers the associated UI element to request permission. void RequestPermissionFromUI( int render_process_id, int render_view_id, int bridge_id, - const std::string& host); + const GURL& requesting_frame); // Notifies whether or not the corresponding render is allowed to use // geolocation. @@ -67,20 +52,8 @@ class GeolocationPermissionContext int render_process_id, int render_view_id, int bridge_id, bool allowed); - // Sets permissions_ cache (if not on IO thread, will forward to it). - void SetPermissionMemoryCacheOnIOThread( - const std::string& host, bool allowed); - // Sets permissions file data (if not on FILE thread, will forward to it). - void SetPermissionOnFileThread(const std::string& host, bool allowed); - // This should only be accessed from the UI thread. Profile* const profile_; - // Indicates whether profile_ is off the record. - bool const is_off_the_record_; - // The path where geolocation permission data is stored. - FilePath const permissions_path_; - // This should only be accessed from the UI thread. - std::map<std::string, bool> permissions_; DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); }; |