Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 binding_.set_connection_error_handler( | 100 binding_.set_connection_error_handler( |
| 101 base::Bind(&PermissionServiceImpl::OnConnectionError, | 101 base::Bind(&PermissionServiceImpl::OnConnectionError, |
| 102 base::Unretained(this))); | 102 base::Unretained(this))); |
| 103 } | 103 } |
| 104 | 104 |
| 105 PermissionServiceImpl::~PermissionServiceImpl() { | 105 PermissionServiceImpl::~PermissionServiceImpl() { |
| 106 DCHECK(pending_requests_.IsEmpty()); | 106 DCHECK(pending_requests_.IsEmpty()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void PermissionServiceImpl::OnConnectionError() { | 109 void PermissionServiceImpl::OnConnectionError() { |
| 110 CancelPendingOperations(); | |
|
Michael van Ouwerkerk
2016/05/04 13:52:16
nit: This might make sense in a separate patch for
Sam McNally
2016/05/05 11:50:23
Done.
| |
| 110 context_->ServiceHadConnectionError(this); | 111 context_->ServiceHadConnectionError(this); |
| 111 // After that call, |this| will be deleted. | 112 // After that call, |this| will be deleted. |
| 112 } | 113 } |
| 113 | 114 |
| 114 void PermissionServiceImpl::RequestPermission( | 115 void PermissionServiceImpl::RequestPermission( |
| 115 PermissionName permission, | 116 PermissionName permission, |
| 116 const mojo::String& origin, | 117 const mojo::String& origin, |
| 117 const PermissionStatusCallback& callback) { | 118 const PermissionStatusCallback& callback) { |
| 118 // This condition is valid if the call is coming from a ChildThread instead of | 119 // This condition is valid if the call is coming from a ChildThread instead of |
| 119 // a RenderFrame. Some consumers of the service run in Workers and some in | 120 // a RenderFrame. Some consumers of the service run in Workers and some in |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 | 365 |
| 365 PermissionStatusCallback callback = subscription->callback; | 366 PermissionStatusCallback callback = subscription->callback; |
| 366 | 367 |
| 367 subscription->callback.reset(); | 368 subscription->callback.reset(); |
| 368 pending_subscriptions_.Remove(pending_subscription_id); | 369 pending_subscriptions_.Remove(pending_subscription_id); |
| 369 | 370 |
| 370 callback.Run(status); | 371 callback.Run(status); |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace content | 374 } // namespace content |
| OLD | NEW |