| 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. |
| 30 void RequestGeolocationPermission( | 31 void RequestGeolocationPermission( |
| 31 int render_process_id, int render_view_id, int bridge_id, | 32 int render_process_id, int render_view_id, int bridge_id, |
| 32 const GURL& requesting_frame); | 33 const GURL& requesting_frame); |
| 33 | 34 |
| 34 // Called once the user sets the geolocation permission. | 35 // Called once the user sets the geolocation permission. |
| 35 // It'll notify the render via ViewMsg_Geolocation_PermissionSet. | 36 // It'll notify the render via ViewMsg_Geolocation_PermissionSet. |
| 36 void SetPermission( | 37 void SetPermission( |
| 37 int render_process_id, int render_view_id, int bridge_id, | 38 int render_process_id, int render_view_id, int bridge_id, |
| 38 const GURL& requesting_frame, bool allowed); | 39 const GURL& requesting_frame, bool allowed); |
| 39 | 40 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 // This should only be accessed from the UI thread. | 66 // This should only be accessed from the UI thread. |
| 66 Profile* const profile_; | 67 Profile* const profile_; |
| 67 | 68 |
| 68 scoped_refptr<GeolocationArbitrator> location_arbitrator_; | 69 scoped_refptr<GeolocationArbitrator> location_arbitrator_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); | 71 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | 74 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
| OLD | NEW |