Index: content/child/permissions/permission_dispatcher.h |
diff --git a/content/child/permissions/permission_dispatcher.h b/content/child/permissions/permission_dispatcher.h |
index 87e464763d4aaeb9d1ee1a1db2205a4a3b92f6d9..bb8276546ea696b7f51409c1548917128b716bc0 100644 |
--- a/content/child/permissions/permission_dispatcher.h |
+++ b/content/child/permissions/permission_dispatcher.h |
@@ -43,6 +43,10 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
virtual void requestPermission(blink::WebPermissionType, |
const blink::WebURL& origin, |
blink::WebPermissionCallback* callback); |
+ virtual void requestPermissions( |
+ const blink::WebVector<blink::WebPermissionType>& types, |
+ const blink::WebURL& origin, |
+ blink::WebPermissionsCallback* callback); |
virtual void revokePermission(blink::WebPermissionType, |
const blink::WebURL& origin, |
blink::WebPermissionCallback* callback); |
@@ -60,6 +64,11 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
const std::string& origin, |
blink::WebPermissionCallback* callback, |
int worker_thread_id); |
+ void RequestPermissionsForWorker( |
+ const blink::WebVector<blink::WebPermissionType>& types, |
+ const std::string& origin, |
+ blink::WebPermissionsCallback* callback, |
+ int worker_thread_id); |
void RevokePermissionForWorker(blink::WebPermissionType type, |
const std::string& origin, |
blink::WebPermissionCallback* callback, |
@@ -82,6 +91,9 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
static void RunCallbackOnWorkerThread( |
blink::WebPermissionCallback* callback, |
scoped_ptr<blink::WebPermissionStatus> status); |
+ static void RunMultiCallbackOnWorkerThread( |
+ blink::WebPermissionsCallback* callback, |
+ scoped_ptr<blink::WebVector<blink::WebPermissionStatus>> statuses); |
// Helper method that returns an initialized PermissionServicePtr. |
PermissionServicePtr& GetPermissionServicePtr(); |
@@ -94,6 +106,11 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
const std::string& origin, |
blink::WebPermissionCallback* callback, |
int worker_thread_id); |
+ void RequestPermissionsInternal( |
+ const blink::WebVector<blink::WebPermissionType>& types, |
+ const std::string& origin, |
+ blink::WebPermissionsCallback* callback, |
+ int worker_thread_id); |
void RevokePermissionInternal(blink::WebPermissionType type, |
const std::string& origin, |
blink::WebPermissionCallback* callback, |
@@ -102,6 +119,8 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
// This is the callback function used for query and revoke |
void OnPermissionResponse(int request_id, |
PermissionStatus status); |
+ void OnPermissionsResponse(int request_id, |
+ const mojo::Array<PermissionStatus>& status); |
void OnPermissionChanged(blink::WebPermissionType type, |
const std::string& origin, |
blink::WebPermissionObserver* observer, |
@@ -138,6 +157,29 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
using CallbackMap = IDMap<CallbackInformation, IDMapOwnPointer>; |
CallbackMap pending_callbacks_; |
+ // Saves some basic information about the callback in order to be able to run |
+ // it in the right thread. |
+ class MultipleCallbackInformation { |
+ public: |
+ MultipleCallbackInformation(blink::WebPermissionsCallback* callback, |
+ int worker_thread_id); |
+ ~MultipleCallbackInformation(); |
+ |
+ blink::WebPermissionsCallback* callback() const; |
+ int worker_thread_id() const; |
+ |
+ blink::WebPermissionsCallback* ReleaseCallback(); |
+ |
+ private: |
+ scoped_ptr<blink::WebPermissionsCallback> callback_; |
+ int worker_thread_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MultipleCallbackInformation); |
+ }; |
+ using MultipleCallbackMap = |
+ IDMap<MultipleCallbackInformation, IDMapOwnPointer>; |
+ MultipleCallbackMap multiple_pending_callbacks_; |
+ |
ServiceRegistry* service_registry_; |
PermissionServicePtr permission_service_; |