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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (!callback.is_null()) | 61 if (!callback.is_null()) |
62 callback.Run(PERMISSION_STATUS_ASK); | 62 callback.Run(PERMISSION_STATUS_ASK); |
63 } | 63 } |
64 | 64 |
65 PermissionServiceImpl::PermissionServiceImpl( | 65 PermissionServiceImpl::PermissionServiceImpl( |
66 PermissionServiceContext* context, | 66 PermissionServiceContext* context, |
67 mojo::InterfaceRequest<PermissionService> request) | 67 mojo::InterfaceRequest<PermissionService> request) |
68 : context_(context), | 68 : context_(context), |
69 binding_(this, request.Pass()), | 69 binding_(this, request.Pass()), |
70 weak_factory_(this) { | 70 weak_factory_(this) { |
| 71 binding_.set_connection_error_handler( |
| 72 base::Bind(&PermissionServiceImpl::OnConnectionError, |
| 73 base::Unretained(this))); |
71 } | 74 } |
72 | 75 |
73 PermissionServiceImpl::~PermissionServiceImpl() { | 76 PermissionServiceImpl::~PermissionServiceImpl() { |
74 DCHECK(pending_requests_.IsEmpty()); | 77 DCHECK(pending_requests_.IsEmpty()); |
75 } | 78 } |
76 | 79 |
77 void PermissionServiceImpl::OnConnectionError() { | 80 void PermissionServiceImpl::OnConnectionError() { |
78 context_->ServiceHadConnectionError(this); | 81 context_->ServiceHadConnectionError(this); |
79 // After that call, |this| will be deleted. | 82 // After that call, |this| will be deleted. |
80 } | 83 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 281 |
279 PermissionStatusCallback callback = subscription->callback; | 282 PermissionStatusCallback callback = subscription->callback; |
280 | 283 |
281 subscription->callback.reset(); | 284 subscription->callback.reset(); |
282 pending_subscriptions_.Remove(pending_subscription_id); | 285 pending_subscriptions_.Remove(pending_subscription_id); |
283 | 286 |
284 callback.Run(status); | 287 callback.Run(status); |
285 } | 288 } |
286 | 289 |
287 } // namespace content | 290 } // namespace content |
OLD | NEW |