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..4859b294870f5f69c6d0c9e9a3486c6e3724a256 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( |
mlamouri (slow - plz ping)
2015/08/18 13:37:15
I think it's find to overload RunCallbackOnWorkerT
Lalit Maganti
2015/08/20 14:23:30
Can't actually do this because I use it in a callb
|
+ 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, |
@@ -118,26 +137,44 @@ class PermissionDispatcher : public blink::WebPermissionClient, |
// Saves some basic information about the callback in order to be able to run |
// it in the right thread. |
+ template<typename T> |
class CallbackInformation { |
public: |
- CallbackInformation(blink::WebPermissionCallback* callback, |
- int worker_thread_id); |
- ~CallbackInformation(); |
+ CallbackInformation(T* callback, |
+ int worker_thread_id) |
+ : callback_(callback), |
+ worker_thread_id_(worker_thread_id) { |
+ } |
+ |
+ ~CallbackInformation() {} |
mlamouri (slow - plz ping)
2015/08/18 13:37:15
nit: = default.
Lalit Maganti
2015/08/20 14:23:30
Removed class.
|
- blink::WebPermissionCallback* callback() const; |
- int worker_thread_id() const; |
+ T* callback() const { |
+ return callback_.get(); |
+ } |
- blink::WebPermissionCallback* ReleaseCallback(); |
+ int worker_thread_id() const { |
+ return worker_thread_id_; |
+ } |
+ |
+ T* ReleaseCallback() { |
+ return callback_.release(); |
+ } |
private: |
- scoped_ptr<blink::WebPermissionCallback> callback_; |
+ scoped_ptr<T> callback_; |
int worker_thread_id_; |
DISALLOW_COPY_AND_ASSIGN(CallbackInformation); |
}; |
- using CallbackMap = IDMap<CallbackInformation, IDMapOwnPointer>; |
+ |
+ using SingleCallbackInfo = CallbackInformation<blink::WebPermissionCallback>; |
mlamouri (slow - plz ping)
2015/08/18 13:37:15
I dislike the name to be honest. Maybe you could c
Lalit Maganti
2015/08/20 14:23:30
The reason I put the using is because the lines be
|
+ using CallbackMap = IDMap<SingleCallbackInfo, IDMapOwnPointer>; |
CallbackMap pending_callbacks_; |
+ using MultiCallbackInfo = CallbackInformation<blink::WebPermissionsCallback>; |
mlamouri (slow - plz ping)
2015/08/18 13:37:15
ditto.
Lalit Maganti
2015/08/20 14:23:30
Acknowledged.
|
+ using MultipleCallbackMap = IDMap<MultiCallbackInfo, IDMapOwnPointer>; |
mlamouri (slow - plz ping)
2015/08/18 13:37:15
Again, the name isn't clear. At least, add a comme
Lalit Maganti
2015/08/20 14:23:30
Acknowledged.
|
+ MultipleCallbackMap multiple_pending_callbacks_; |
+ |
ServiceRegistry* service_registry_; |
PermissionServicePtr permission_service_; |