| 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/renderer/presentation/presentation_dispatcher.h" | 5 #include "content/renderer/presentation/presentation_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/presentation/presentation_service.mojom.h" | 8 #include "content/common/presentation/presentation_service.mojom.h" |
| 9 #include "content/public/common/service_registry.h" | 9 #include "content/public/common/service_registry.h" |
| 10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 void PresentationDispatcher::OnSessionCreated( | 116 void PresentationDispatcher::OnSessionCreated( |
| 117 blink::WebPresentationSessionClientCallbacks* callback, | 117 blink::WebPresentationSessionClientCallbacks* callback, |
| 118 presentation::PresentationSessionInfoPtr session_info, | 118 presentation::PresentationSessionInfoPtr session_info, |
| 119 presentation::PresentationErrorPtr error) { | 119 presentation::PresentationErrorPtr error) { |
| 120 DCHECK(callback); | 120 DCHECK(callback); |
| 121 if (!error.is_null()) { | 121 if (!error.is_null()) { |
| 122 DCHECK(session_info.is_null()); | 122 DCHECK(session_info.is_null()); |
| 123 callback->onError(new blink::WebPresentationError( | 123 callback->onError(new blink::WebPresentationError( |
| 124 GetWebPresentationErrorTypeFromMojo(error->errorType), | 124 GetWebPresentationErrorTypeFromMojo(error->error_type), |
| 125 blink::WebString::fromUTF8(error->message))); | 125 blink::WebString::fromUTF8(error->message))); |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 | 128 |
| 129 DCHECK(!session_info.is_null()); | 129 DCHECK(!session_info.is_null()); |
| 130 PresentationSessionDispatcher* session_dispatcher = | 130 PresentationSessionDispatcher* session_dispatcher = |
| 131 new PresentationSessionDispatcher(session_info.Pass()); | 131 new PresentationSessionDispatcher(session_info.Pass()); |
| 132 presentation_session_dispatchers_.push_back(session_dispatcher); | 132 presentation_session_dispatchers_.push_back(session_dispatcher); |
| 133 callback->onSuccess(new PresentationSessionClient(session_dispatcher)); | 133 callback->onSuccess(new PresentationSessionClient(session_dispatcher)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { | 136 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { |
| 137 if (presentation_service_.get()) | 137 if (presentation_service_.get()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 render_frame()->GetServiceRegistry()->ConnectToRemoteService( | 140 render_frame()->GetServiceRegistry()->ConnectToRemoteService( |
| 141 &presentation_service_); | 141 &presentation_service_); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace content | 144 } // namespace content |
| OLD | NEW |