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
3 // found in the LICENSE file.
5 #ifndef WebPermissionClient_h
6 #define WebPermissionClient_h
8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebPassOwnPtr.h"
10 #include "public/platform/WebVector.h"
11 #include "public/platform/modules/permissions/WebPermissionStatus.h"
12 #include "public/platform/modules/permissions/WebPermissionType.h"
16 using WebPermissionCallback
= WebCallbacks
<WebPermissionStatus
, void>;
17 using WebPermissionsCallback
= WebCallbacks
<WebPassOwnPtr
<WebVector
<WebPermissionStatus
>>, void>;
19 class WebPermissionObserver
;
22 // This client is expected to do general permission handling. From simple
23 // permission query to requesting new permissions.
24 class WebPermissionClient
{
26 // Query the permission status of a given origin for a specific permission.
27 virtual void queryPermission(WebPermissionType
, const WebURL
&, WebPermissionCallback
*) { }
29 // Request a specific permission for a given origin.
30 virtual void requestPermission(WebPermissionType
, const WebURL
&, WebPermissionCallback
*) { }
32 // Request some permissions for a given origin.
33 virtual void requestPermissions(const WebVector
<WebPermissionType
>&, const WebURL
&, WebPermissionsCallback
*) { }
35 // Revoke a specific permission for a given origin.
36 virtual void revokePermission(WebPermissionType
, const WebURL
&, WebPermissionCallback
*) { }
38 // Listen for permission changes for a given origin and inform the observer
39 // when they happen. The observer is not owned by the WebPermissionClient.
40 // The client should expect stopListening() to be called when the observer
42 virtual void startListening(WebPermissionType
, const WebURL
&, WebPermissionObserver
*) { }
44 // Stop listening to all the permission changes associated with the given
46 virtual void stopListening(WebPermissionObserver
*) { }
49 virtual ~WebPermissionClient() { }
54 #endif // WebPermissionClient_h