Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: content/renderer/presentation/presentation_connection_proxy.cc

Issue 2714693002: [Presentation API] Use connection proxy to change connection state to 'closed' (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698