Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / modules / permissions / WebPermissionClient.h
blobf851050c5d66361073f23d9e1fb9a4b194e76793
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"
14 namespace blink {
16 using WebPermissionCallback = WebCallbacks<WebPermissionStatus, void>;
17 using WebPermissionsCallback = WebCallbacks<WebPassOwnPtr<WebVector<WebPermissionStatus>>, void>;
19 class WebPermissionObserver;
20 class WebURL;
22 // This client is expected to do general permission handling. From simple
23 // permission query to requesting new permissions.
24 class WebPermissionClient {
25 public:
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
41 // will be destroyed.
42 virtual void startListening(WebPermissionType, const WebURL&, WebPermissionObserver*) { }
44 // Stop listening to all the permission changes associated with the given
45 // observer.
46 virtual void stopListening(WebPermissionObserver*) { }
48 protected:
49 virtual ~WebPermissionClient() { }
52 } // namespace blink
54 #endif // WebPermissionClient_h