OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/permissions/permission_service_impl.h" | 5 #include "content/browser/permissions/permission_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/permission_manager.h" | 9 #include "content/public/browser/permission_manager.h" |
10 #include "content/public/browser/permission_type.h" | 10 #include "content/public/browser/permission_type.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 permission_type, | 124 permission_type, |
125 context_->render_frame_host(), | 125 context_->render_frame_host(), |
126 request_id, | 126 request_id, |
127 GURL(origin), | 127 GURL(origin), |
128 user_gesture, // TODO(mlamouri): should be removed (crbug.com/423770) | 128 user_gesture, // TODO(mlamouri): should be removed (crbug.com/423770) |
129 base::Bind(&PermissionServiceImpl::OnRequestPermissionResponse, | 129 base::Bind(&PermissionServiceImpl::OnRequestPermissionResponse, |
130 weak_factory_.GetWeakPtr(), | 130 weak_factory_.GetWeakPtr(), |
131 request_id)); | 131 request_id)); |
132 } | 132 } |
133 | 133 |
134 void PermissionServiceImpl::RequestPermissions( | |
135 mojo::Array<PermissionName> permissions, | |
136 const mojo::String& origin, | |
137 bool user_gesture, | |
138 const PermissionsStatusCallback& callback) { | |
139 NOTIMPLEMENTED(); | |
140 | |
141 mojo::Array<PermissionStatus> result(permissions.size()); | |
mlamouri (slow - plz ping)
2015/09/04 15:04:13
add:
TODO(lalitm,mlamouri): this is returning the
Lalit Maganti
2015/09/04 16:07:28
Done.
| |
142 for (size_t i = 0; i < permissions.size(); ++i) | |
143 result[i] = GetPermissionStatusFromName(permissions[i], GURL(origin)); | |
144 callback.Run(result.Pass()); | |
145 } | |
146 | |
134 void PermissionServiceImpl::OnRequestPermissionResponse( | 147 void PermissionServiceImpl::OnRequestPermissionResponse( |
135 int request_id, | 148 int request_id, |
136 PermissionStatus status) { | 149 PermissionStatus status) { |
137 PendingRequest* request = pending_requests_.Lookup(request_id); | 150 PendingRequest* request = pending_requests_.Lookup(request_id); |
138 PermissionStatusCallback callback(request->callback); | 151 PermissionStatusCallback callback(request->callback); |
139 request->callback.reset(); | 152 request->callback.reset(); |
140 pending_requests_.Remove(request_id); | 153 pending_requests_.Remove(request_id); |
141 callback.Run(status); | 154 callback.Run(status); |
142 } | 155 } |
143 | 156 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 | 302 |
290 PermissionStatusCallback callback = subscription->callback; | 303 PermissionStatusCallback callback = subscription->callback; |
291 | 304 |
292 subscription->callback.reset(); | 305 subscription->callback.reset(); |
293 pending_subscriptions_.Remove(pending_subscription_id); | 306 pending_subscriptions_.Remove(pending_subscription_id); |
294 | 307 |
295 callback.Run(status); | 308 callback.Run(status); |
296 } | 309 } |
297 | 310 |
298 } // namespace content | 311 } // namespace content |
OLD | NEW |