Chromium Code Reviews| Index: content/renderer/presentation/presentation_connection_proxy.cc |
| diff --git a/content/renderer/presentation/presentation_connection_proxy.cc b/content/renderer/presentation/presentation_connection_proxy.cc |
| index 3b5f508755914103b64743aac1a8e67430b096da..aebff14183ac5a7de998df1213d7c7f8da41c179 100644 |
| --- a/content/renderer/presentation/presentation_connection_proxy.cc |
| +++ b/content/renderer/presentation/presentation_connection_proxy.cc |
| @@ -63,15 +63,28 @@ void PresentationConnectionProxy::OnMessage( |
| // in a single place. |
| void PresentationConnectionProxy::DidChangeState( |
| content::PresentationConnectionState state) { |
| - if (state != content::PRESENTATION_CONNECTION_STATE_CONNECTED) { |
| - // |DidChangeState| should only handle state transition from connecting -> |
| - // connected. PresentationService and MRP handles other state transitions. |
| + if (state == content::PRESENTATION_CONNECTION_STATE_CONNECTED) { |
| + source_connection_->didChangeState( |
| + blink::WebPresentationConnectionState::Connected); |
|
dcheng
2017/03/02 07:31:07
Kind of feels like it'd be easier to just pass in
zhaobin
2017/03/02 21:52:20
Created crbug.com/698000.
|
| + } else if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) { |
| + source_connection_->didChangeState( |
| + blink::WebPresentationConnectionState::Closed); |
| + } else { |
| NOTREACHED(); |
| - return; |
| } |
| +} |
| +void PresentationConnectionProxy::OnClose() { |
| + DCHECK(target_connection_ptr_); |
| source_connection_->didChangeState( |
| - blink::WebPresentationConnectionState::Connected); |
| + blink::WebPresentationConnectionState::Closed); |
| + target_connection_ptr_->DidChangeState( |
| + content::PRESENTATION_CONNECTION_STATE_CLOSED); |
| +} |
| + |
| +void PresentationConnectionProxy::close() const { |
| + DCHECK(target_connection_ptr_); |
| + target_connection_ptr_->OnClose(); |
| } |
| ControllerConnectionProxy::ControllerConnectionProxy( |