| Index: chrome/browser/geolocation/geolocation_permission_context.h
|
| diff --git a/chrome/browser/geolocation/geolocation_permission_context.h b/chrome/browser/geolocation/geolocation_permission_context.h
|
| index 6b79fd75780695880c8f5df673e1413c43ed0341..1411edd509009694d7fc7ec4649689ee32f47731 100644
|
| --- a/chrome/browser/geolocation/geolocation_permission_context.h
|
| +++ b/chrome/browser/geolocation/geolocation_permission_context.h
|
| @@ -11,19 +11,18 @@
|
| #include "base/ref_counted.h"
|
|
|
| class GeolocationDispatcherHost;
|
| -class Profile;
|
| +class GURL;
|
| +class HostContentSettingsMap;
|
| class RenderViewHost;
|
| +class TabContents;
|
|
|
| -// 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 via
|
| +// HostContentSettingsMap.
|
| class GeolocationPermissionContext
|
| : public base::RefCountedThreadSafe<GeolocationPermissionContext> {
|
| public:
|
| - explicit GeolocationPermissionContext(Profile* profile);
|
| + explicit GeolocationPermissionContext(
|
| + HostContentSettingsMap* host_content_settings_map);
|
|
|
| // The render is requesting permission to use Geolocation.
|
| // Response will be sent asynchronously as ViewMsg_Geolocation_PermissionSet.
|
| @@ -32,30 +31,20 @@ class GeolocationPermissionContext
|
| int render_process_id, int render_view_id, int bridge_id,
|
| const std::string& host);
|
|
|
| - // Called once the user sets the geolocation permission.
|
| - // It'll update the internal state on different threads via
|
| - // SetPermissionMemoryCacheOnIOThread and SetPermissionOnFileThread.
|
| - void SetPermission(
|
| + // Called once the user sets the geolocation permission from the infobar.
|
| + void SetPermissionFromInfobar(
|
| int render_process_id, int render_view_id, int bridge_id,
|
| const std::string& host, bool allowed);
|
|
|
| + // Called once the user sets the geolocation permission from the content
|
| + // bubble.
|
| + void SetPermissionFromContentBubble(
|
| + TabContents* tab_contents, const std::string& host, 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,
|
| @@ -65,22 +54,10 @@ class GeolocationPermissionContext
|
| // geolocation.
|
| void NotifyPermissionSet(
|
| 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_;
|
| + // Used to persist permission settings.
|
| + scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext);
|
| };
|
|
|