| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 | 12 |
| 13 class GeolocationDispatcherHost; | 13 class GeolocationDispatcherHost; |
| 14 class GURL; | 14 class GURL; |
| 15 class GeolocationArbitrator; | 15 class GeolocationArbitrator; |
| 16 class Profile; | 16 class Profile; |
| 17 class RenderViewHost; | 17 class RenderViewHost; |
| 18 | 18 |
| 19 // GeolocationPermissionContext manages Geolocation permissions flow, | 19 // GeolocationPermissionContext manages Geolocation permissions flow, |
| 20 // creating UI elements to ask the user for permission when necessary. | 20 // creating UI elements to ask the user for permission when necessary. |
| 21 // It always notifies the requesting render_view asynchronously via | 21 // It always notifies the requesting render_view asynchronously via |
| 22 // ViewMsg_Geolocation_PermissionSet. | 22 // ViewMsg_Geolocation_PermissionSet. |
| 23 class GeolocationPermissionContext | 23 class GeolocationPermissionContext |
| 24 : public base::RefCountedThreadSafe<GeolocationPermissionContext> { | 24 : public base::RefCountedThreadSafe<GeolocationPermissionContext> { |
| 25 public: | 25 public: |
| 26 explicit GeolocationPermissionContext(Profile* profile); | 26 explicit GeolocationPermissionContext(Profile* profile); |
| 27 | 27 |
| 28 // The render is requesting permission to use Geolocation. | 28 // The render is requesting permission to use Geolocation. |
| 29 // Response will be sent asynchronously as ViewMsg_Geolocation_PermissionSet. | 29 // Response will be sent asynchronously as ViewMsg_Geolocation_PermissionSet. |
| 30 // Must be called from the IO thread. | |
| 31 void RequestGeolocationPermission( | 30 void RequestGeolocationPermission( |
| 32 int render_process_id, int render_view_id, int bridge_id, | 31 int render_process_id, int render_view_id, int bridge_id, |
| 33 const GURL& requesting_frame); | 32 const GURL& requesting_frame); |
| 34 | 33 |
| 35 // Called once the user sets the geolocation permission. | 34 // Called once the user sets the geolocation permission. |
| 36 // It'll notify the render via ViewMsg_Geolocation_PermissionSet. | 35 // It'll notify the render via ViewMsg_Geolocation_PermissionSet. |
| 37 void SetPermission( | 36 void SetPermission( |
| 38 int render_process_id, int render_view_id, int bridge_id, | 37 int render_process_id, int render_view_id, int bridge_id, |
| 39 const GURL& requesting_frame, bool allowed); | 38 const GURL& requesting_frame, bool allowed); |
| 40 | 39 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 | 64 |
| 66 // This should only be accessed from the UI thread. | 65 // This should only be accessed from the UI thread. |
| 67 Profile* const profile_; | 66 Profile* const profile_; |
| 68 | 67 |
| 69 scoped_refptr<GeolocationArbitrator> location_arbitrator_; | 68 scoped_refptr<GeolocationArbitrator> location_arbitrator_; |
| 70 | 69 |
| 71 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); | 70 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 73 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| OLD | NEW |