OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebPermissionClient_h | 5 #ifndef WebPermissionClient_h |
6 #define WebPermissionClient_h | 6 #define WebPermissionClient_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/WebCommon.h" |
9 #include "public/platform/modules/permissions/WebPermissionStatus.h" | 10 #include "public/platform/modules/permissions/WebPermissionStatus.h" |
10 #include "public/platform/modules/permissions/WebPermissionType.h" | 11 #include "public/platform/modules/permissions/WebPermissionType.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 using WebPermissionQueryCallback = WebCallbacks<WebPermissionStatus, void>; | 15 using WebPermissionQueryCallback = WebCallbacks<WebPermissionStatus, void>; |
15 | 16 |
| 17 class ExecutionContext; |
16 class WebPermissionObserver; | 18 class WebPermissionObserver; |
17 class WebURL; | 19 class WebURL; |
18 | 20 |
19 // This client is expected to do general permission handling. From simple | 21 // This client is expected to do general permission handling. From simple |
20 // permission query to requesting new permissions. | 22 // permission query to requesting new permissions. |
21 class WebPermissionClient { | 23 class WebPermissionClient { |
22 public: | 24 public: |
| 25 |
| 26 virtual void requestDurablePermission(const WebURL&, WebPermissionQueryCallb
ack*) { } |
| 27 |
23 // Query the permission status of a given origin for a specific permission. | 28 // Query the permission status of a given origin for a specific permission. |
24 virtual void queryPermission(WebPermissionType, const WebURL&, WebPermission
QueryCallback*) { } | 29 virtual void queryPermission(WebPermissionType, const WebURL&, WebPermission
QueryCallback*) { } |
25 | 30 |
26 // Listen for permission changes for a given origin and inform the observer | 31 // Listen for permission changes for a given origin and inform the observer |
27 // when they happen. The observer is not owned by the WebPermissionClient. | 32 // when they happen. The observer is not owned by the WebPermissionClient. |
28 // The client should expect stopListening() to be called when the observer | 33 // The client should expect stopListening() to be called when the observer |
29 // will be destroyed. | 34 // will be destroyed. |
30 virtual void startListening(WebPermissionType, const WebURL&, WebPermissionO
bserver*) { } | 35 virtual void startListening(WebPermissionType, const WebURL&, WebPermissionO
bserver*) { } |
31 | 36 |
32 // Stop listening to all the permission changes associated with the given | 37 // Stop listening to all the permission changes associated with the given |
33 // observer. | 38 // observer. |
34 virtual void stopListening(WebPermissionObserver*) { } | 39 virtual void stopListening(WebPermissionObserver*) { } |
35 | 40 |
| 41 #if BLINK_IMPLEMENTATION |
| 42 static WebPermissionClient* get(ExecutionContext*); |
| 43 #endif |
| 44 |
36 protected: | 45 protected: |
37 virtual ~WebPermissionClient() { } | 46 virtual ~WebPermissionClient() { } |
38 }; | 47 }; |
39 | 48 |
40 } // namespace blink | 49 } // namespace blink |
41 | 50 |
42 #endif // WebPermissionClient_h | 51 #endif // WebPermissionClient_h |
OLD | NEW |