| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | |
| 6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/ref_counted.h" | |
| 11 #include "base/scoped_ptr.h" | |
| 12 | |
| 13 class GeolocationInfoBarQueueController; | |
| 14 class GeolocationPermissionContext; | |
| 15 class GURL; | |
| 16 class InfoBarDelegate; | |
| 17 class Profile; | |
| 18 class RenderViewHost; | |
| 19 class TabContents; | |
| 20 | |
| 21 // GeolocationPermissionContext manages Geolocation permissions flow, | |
| 22 // and delegates UI handling via GeolocationInfoBarQueueController. | |
| 23 // It always notifies the requesting render_view asynchronously via | |
| 24 // ViewMsg_Geolocation_PermissionSet. | |
| 25 class GeolocationPermissionContext | |
| 26 : public base::RefCountedThreadSafe<GeolocationPermissionContext> { | |
| 27 public: | |
| 28 explicit GeolocationPermissionContext(Profile* profile); | |
| 29 | |
| 30 // The render is requesting permission to use Geolocation. | |
| 31 // Response will be sent asynchronously as ViewMsg_Geolocation_PermissionSet. | |
| 32 void RequestGeolocationPermission( | |
| 33 int render_process_id, int render_view_id, int bridge_id, | |
| 34 const GURL& requesting_frame); | |
| 35 | |
| 36 // The render is cancelling a pending permission request. | |
| 37 void CancelGeolocationPermissionRequest( | |
| 38 int render_process_id, int render_view_id, int bridge_id, | |
| 39 const GURL& requesting_frame); | |
| 40 | |
| 41 // Notifies whether or not the corresponding bridge is allowed to use | |
| 42 // geolocation via ViewMsg_Geolocation_PermissionSet. | |
| 43 void NotifyPermissionSet( | |
| 44 int render_process_id, int render_view_id, int bridge_id, | |
| 45 const GURL& requesting_frame, bool allowed); | |
| 46 | |
| 47 private: | |
| 48 friend class base::RefCountedThreadSafe<GeolocationPermissionContext>; | |
| 49 virtual ~GeolocationPermissionContext(); | |
| 50 | |
| 51 // Calls GeolocationArbitrator::OnPermissionGranted. | |
| 52 void NotifyArbitratorPermissionGranted(const GURL& requesting_frame); | |
| 53 | |
| 54 // Removes any pending InfoBar request. | |
| 55 void CancelPendingInfoBarRequest( | |
| 56 int render_process_id, int render_view_id, int bridge_id); | |
| 57 | |
| 58 // This should only be accessed from the UI thread. | |
| 59 Profile* const profile_; | |
| 60 | |
| 61 scoped_ptr<GeolocationInfoBarQueueController> | |
| 62 geolocation_infobar_queue_controller_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); | |
| 65 }; | |
| 66 | |
| 67 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | |
| OLD | NEW |