| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_connection_proxy.h" | 5 #include "content/renderer/presentation/presentation_connection_proxy.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/public/common/presentation_session.h" | 8 #include "content/public/common/presentation_session.h" |
| 9 #include "content/renderer/presentation/presentation_dispatcher.h" | 9 #include "content/renderer/presentation/presentation_dispatcher.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions | 62 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions |
| 63 // in a single place. | 63 // in a single place. |
| 64 void PresentationConnectionProxy::DidChangeState( | 64 void PresentationConnectionProxy::DidChangeState( |
| 65 content::PresentationConnectionState state) { | 65 content::PresentationConnectionState state) { |
| 66 if (state == content::PRESENTATION_CONNECTION_STATE_CONNECTED) { | 66 if (state == content::PRESENTATION_CONNECTION_STATE_CONNECTED) { |
| 67 source_connection_->didChangeState( | 67 source_connection_->didChangeState( |
| 68 blink::WebPresentationConnectionState::Connected); | 68 blink::WebPresentationConnectionState::Connected); |
| 69 } else if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) { | 69 } else if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) { |
| 70 source_connection_->didChangeState( | 70 source_connection_->didClose(); |
| 71 blink::WebPresentationConnectionState::Closed); | |
| 72 } else { | 71 } else { |
| 73 NOTREACHED(); | 72 NOTREACHED(); |
| 74 } | 73 } |
| 75 } | 74 } |
| 76 | 75 |
| 77 void PresentationConnectionProxy::OnClose() { | 76 void PresentationConnectionProxy::OnClose() { |
| 78 DCHECK(target_connection_ptr_); | 77 DCHECK(target_connection_ptr_); |
| 79 source_connection_->didChangeState( | 78 source_connection_->didClose(); |
| 80 blink::WebPresentationConnectionState::Closed); | |
| 81 target_connection_ptr_->DidChangeState( | 79 target_connection_ptr_->DidChangeState( |
| 82 content::PRESENTATION_CONNECTION_STATE_CLOSED); | 80 content::PRESENTATION_CONNECTION_STATE_CLOSED); |
| 83 } | 81 } |
| 84 | 82 |
| 85 void PresentationConnectionProxy::close() const { | 83 void PresentationConnectionProxy::close() const { |
| 86 DCHECK(target_connection_ptr_); | 84 DCHECK(target_connection_ptr_); |
| 87 target_connection_ptr_->OnClose(); | 85 target_connection_ptr_->OnClose(); |
| 88 } | 86 } |
| 89 | 87 |
| 90 ControllerConnectionProxy::ControllerConnectionProxy( | 88 ControllerConnectionProxy::ControllerConnectionProxy( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 blink::mojom::PresentationConnectionPtr controller_connection_ptr) { | 117 blink::mojom::PresentationConnectionPtr controller_connection_ptr) { |
| 120 DCHECK(!target_connection_ptr_); | 118 DCHECK(!target_connection_ptr_); |
| 121 target_connection_ptr_ = std::move(controller_connection_ptr); | 119 target_connection_ptr_ = std::move(controller_connection_ptr); |
| 122 target_connection_ptr_->DidChangeState( | 120 target_connection_ptr_->DidChangeState( |
| 123 content::PRESENTATION_CONNECTION_STATE_CONNECTED); | 121 content::PRESENTATION_CONNECTION_STATE_CONNECTED); |
| 124 | 122 |
| 125 DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED); | 123 DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED); |
| 126 } | 124 } |
| 127 | 125 |
| 128 } // namespace content | 126 } // namespace content |
| OLD | NEW |