OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/child/permissions/permission_dispatcher.h" | 5 #include "content/child/permissions/permission_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 base::Passed(&callback), status)); | 343 base::Passed(&callback), status)); |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
347 callback->onSuccess(status); | 347 callback->onSuccess(status); |
348 } | 348 } |
349 | 349 |
350 void PermissionDispatcher::OnRequestPermissionsResponse( | 350 void PermissionDispatcher::OnRequestPermissionsResponse( |
351 int worker_thread_id, | 351 int worker_thread_id, |
352 uintptr_t callback_key, | 352 uintptr_t callback_key, |
353 const mojo::Array<PermissionStatus>& result) { | 353 mojo::Array<PermissionStatus> result) { |
354 std::unique_ptr<blink::WebPermissionsCallback> callback = | 354 std::unique_ptr<blink::WebPermissionsCallback> callback = |
355 permissions_callbacks_.take_and_erase(callback_key); | 355 permissions_callbacks_.take_and_erase(callback_key); |
356 std::unique_ptr<blink::WebVector<blink::WebPermissionStatus>> statuses( | 356 std::unique_ptr<blink::WebVector<blink::WebPermissionStatus>> statuses( |
357 new blink::WebVector<blink::WebPermissionStatus>(result.size())); | 357 new blink::WebVector<blink::WebPermissionStatus>(result.size())); |
358 | 358 |
359 for (size_t i = 0; i < result.size(); i++) | 359 for (size_t i = 0; i < result.size(); i++) |
360 statuses->operator[](i) = GetWebPermissionStatus(result[i]); | 360 statuses->operator[](i) = GetWebPermissionStatus(result[i]); |
361 | 361 |
362 if (worker_thread_id != kNoWorkerThread) { | 362 if (worker_thread_id != kNoWorkerThread) { |
363 // If the worker is no longer running, ::PostTask() will return false and | 363 // If the worker is no longer running, ::PostTask() will return false and |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 origin, | 404 origin, |
405 current_status, | 405 current_status, |
406 base::Bind(&PermissionDispatcher::OnPermissionChanged, | 406 base::Bind(&PermissionDispatcher::OnPermissionChanged, |
407 base::Unretained(this), | 407 base::Unretained(this), |
408 type, | 408 type, |
409 origin, | 409 origin, |
410 base::Unretained(observer))); | 410 base::Unretained(observer))); |
411 } | 411 } |
412 | 412 |
413 } // namespace content | 413 } // namespace content |
OLD | NEW |