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/browser/presentation/presentation_service_impl.h" | 5 #include "content/browser/presentation/presentation_service_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 web_contents, | 162 web_contents, |
163 GetContentClient()->browser()->GetPresentationServiceDelegate( | 163 GetContentClient()->browser()->GetPresentationServiceDelegate( |
164 web_contents)); | 164 web_contents)); |
165 impl->Bind(request.Pass()); | 165 impl->Bind(request.Pass()); |
166 } | 166 } |
167 | 167 |
168 void PresentationServiceImpl::Bind( | 168 void PresentationServiceImpl::Bind( |
169 mojo::InterfaceRequest<presentation::PresentationService> request) { | 169 mojo::InterfaceRequest<presentation::PresentationService> request) { |
170 binding_.reset(new mojo::Binding<presentation::PresentationService>( | 170 binding_.reset(new mojo::Binding<presentation::PresentationService>( |
171 this, request.Pass())); | 171 this, request.Pass())); |
172 binding_->set_error_handler(this); | 172 binding_->set_connection_error_handler([this]() { |
173 } | 173 DVLOG(1) << "Connection error"; |
174 | 174 delete this; |
175 void PresentationServiceImpl::OnConnectionError() { | 175 }); |
176 DVLOG(1) << "OnConnectionError"; | |
177 delete this; | |
178 } | 176 } |
179 | 177 |
180 void PresentationServiceImpl::SetClient( | 178 void PresentationServiceImpl::SetClient( |
181 presentation::PresentationServiceClientPtr client) { | 179 presentation::PresentationServiceClientPtr client) { |
182 DCHECK(!client_.get()); | 180 DCHECK(!client_.get()); |
183 // TODO(imcheng): Set ErrorHandler to listen for errors. | 181 // TODO(imcheng): Set ErrorHandler to listen for errors. |
184 client_ = client.Pass(); | 182 client_ = client.Pass(); |
185 } | 183 } |
186 | 184 |
187 void PresentationServiceImpl::ListenForScreenAvailability( | 185 void PresentationServiceImpl::ListenForScreenAvailability( |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 627 |
630 void PresentationServiceImpl::DefaultSessionStartContext::Reset() { | 628 void PresentationServiceImpl::DefaultSessionStartContext::Reset() { |
631 ScopedVector<DefaultSessionMojoCallback> callbacks; | 629 ScopedVector<DefaultSessionMojoCallback> callbacks; |
632 callbacks.swap(callbacks_); | 630 callbacks.swap(callbacks_); |
633 for (const auto& callback : callbacks) | 631 for (const auto& callback : callbacks) |
634 callback->Run(presentation::PresentationSessionInfoPtr()); | 632 callback->Run(presentation::PresentationSessionInfoPtr()); |
635 session_.reset(); | 633 session_.reset(); |
636 } | 634 } |
637 | 635 |
638 } // namespace content | 636 } // namespace content |
OLD | NEW |