| 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/renderer/presentation/presentation_dispatcher.h" | 9 #include "content/renderer/presentation/presentation_dispatcher.h" |
| 9 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| 10 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nConnection.h" | 11 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nConnection.h" |
| 11 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" | 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" |
| 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" | 13 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 PresentationConnectionProxy::PresentationConnectionProxy( | 17 PresentationConnectionProxy::PresentationConnectionProxy( |
| 17 blink::WebPresentationConnection* source_connection) | 18 blink::WebPresentationConnection* source_connection) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return; | 55 return; |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 callback.Run(true); | 59 callback.Run(true); |
| 59 } | 60 } |
| 60 | 61 |
| 61 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions | 62 // TODO(crbug.com/588874): Ensure legal PresentationConnection state transitions |
| 62 // in a single place. | 63 // in a single place. |
| 63 void PresentationConnectionProxy::DidChangeState( | 64 void PresentationConnectionProxy::DidChangeState( |
| 64 blink::mojom::PresentationConnectionState state) { | 65 content::PresentationConnectionState state) { |
| 65 if (state != blink::mojom::PresentationConnectionState::CONNECTED) { | 66 if (state != content::PRESENTATION_CONNECTION_STATE_CONNECTED) { |
| 66 // |DidChangeState| should only handle state transition from connecting -> | 67 // |DidChangeState| should only handle state transition from connecting -> |
| 67 // connected. PresentationService and MRP handles other state transitions. | 68 // connected. PresentationService and MRP handles other state transitions. |
| 68 NOTREACHED(); | 69 NOTREACHED(); |
| 69 return; | 70 return; |
| 70 } | 71 } |
| 71 | 72 |
| 72 source_connection_->didChangeState( | 73 source_connection_->didChangeState( |
| 73 blink::WebPresentationConnectionState::Connected); | 74 blink::WebPresentationConnectionState::Connected); |
| 74 } | 75 } |
| 75 | 76 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 void ReceiverConnectionProxy::Bind( | 100 void ReceiverConnectionProxy::Bind( |
| 100 blink::mojom::PresentationConnectionRequest receiver_connection_request) { | 101 blink::mojom::PresentationConnectionRequest receiver_connection_request) { |
| 101 binding_.Bind(std::move(receiver_connection_request)); | 102 binding_.Bind(std::move(receiver_connection_request)); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void ReceiverConnectionProxy::BindControllerConnection( | 105 void ReceiverConnectionProxy::BindControllerConnection( |
| 105 blink::mojom::PresentationConnectionPtr controller_connection_ptr) { | 106 blink::mojom::PresentationConnectionPtr controller_connection_ptr) { |
| 106 DCHECK(!target_connection_ptr_); | 107 DCHECK(!target_connection_ptr_); |
| 107 target_connection_ptr_ = std::move(controller_connection_ptr); | 108 target_connection_ptr_ = std::move(controller_connection_ptr); |
| 108 target_connection_ptr_->DidChangeState( | 109 target_connection_ptr_->DidChangeState( |
| 109 blink::mojom::PresentationConnectionState::CONNECTED); | 110 content::PRESENTATION_CONNECTION_STATE_CONNECTED); |
| 110 | 111 |
| 111 DidChangeState(blink::mojom::PresentationConnectionState::CONNECTED); | 112 DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED); |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace content | 115 } // namespace content |
| OLD | NEW |