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

Unified Diff: content/browser/presentation/presentation_service_impl.cc

Issue 2470023002: [Presentation API] change initial state of PresentationConnection to 'connecting' (Closed)
Patch Set: resolve code review comments from Derek and rebase with master Created 4 years, 1 month 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/browser/presentation/presentation_service_impl.cc
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index 46ec67cf0158791d666a023c92abfb3e71e47546..1a23a37ed6103e17bbd7ad61ee4eac6cc63b252c 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -284,13 +284,16 @@ int PresentationServiceImpl::RegisterJoinSessionCallback(
return request_id;
}
-void PresentationServiceImpl::ListenForConnectionStateChange(
+void PresentationServiceImpl::ListenForConnectionStateChangeAndChangeState(
const PresentationSessionInfo& connection) {
if (delegate_) {
delegate_->ListenForConnectionStateChange(
render_process_id_, render_frame_id_, connection,
base::Bind(&PresentationServiceImpl::OnConnectionStateChanged,
weak_factory_.GetWeakPtr(), connection));
+ OnConnectionStateChanged(connection,
+ PresentationConnectionStateChangeInfo(
+ PRESENTATION_CONNECTION_STATE_CONNECTED));
}
}
@@ -304,7 +307,7 @@ void PresentationServiceImpl::OnStartSessionSucceeded(
pending_start_session_cb_->Run(
blink::mojom::PresentationSessionInfo::From(session_info),
blink::mojom::PresentationErrorPtr());
- ListenForConnectionStateChange(session_info);
+ ListenForConnectionStateChangeAndChangeState(session_info);
pending_start_session_cb_.reset();
start_session_request_id_ = kInvalidRequestSessionId;
}
@@ -329,7 +332,7 @@ void PresentationServiceImpl::OnJoinSessionSucceeded(
request_session_id,
blink::mojom::PresentationSessionInfo::From(session_info),
blink::mojom::PresentationErrorPtr())) {
- ListenForConnectionStateChange(session_info);
+ ListenForConnectionStateChangeAndChangeState(session_info);
}
}
@@ -421,6 +424,9 @@ void PresentationServiceImpl::Terminate(const GURL& presentation_url,
void PresentationServiceImpl::OnConnectionStateChanged(
const PresentationSessionInfo& connection,
const PresentationConnectionStateChangeInfo& info) {
+ DVLOG(2) << "PresentationServiceImpl::OnConnectionStateChanged "
+ << "[presentation_id]: " << connection.presentation_id
+ << " [state]: " << info.state;
DCHECK(client_.get());
if (info.state == PRESENTATION_CONNECTION_STATE_CLOSED) {
client_->OnConnectionClosed(
@@ -556,7 +562,7 @@ void PresentationServiceImpl::OnDefaultPresentationStarted(
DCHECK(client_.get());
client_->OnDefaultSessionStarted(
blink::mojom::PresentationSessionInfo::From(connection));
- ListenForConnectionStateChange(connection);
+ ListenForConnectionStateChangeAndChangeState(connection);
}
PresentationServiceImpl::ScreenAvailabilityListenerImpl::

Powered by Google App Engine
This is Rietveld 408576698