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

Unified Diff: extensions/renderer/display_source_custom_bindings.cc

Issue 1540563002: [chrome.displaySource] Add WiFi Display session class skeleton and mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 11 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
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/display_source_custom_bindings.cc
diff --git a/extensions/renderer/display_source_custom_bindings.cc b/extensions/renderer/display_source_custom_bindings.cc
index 8be830c39f5f05c8d27f786651fb4037d9ea4201..50752c0e0a18feb6207b1e77e4d9a115ee860c76 100644
--- a/extensions/renderer/display_source_custom_bindings.cc
+++ b/extensions/renderer/display_source_custom_bindings.cc
@@ -135,9 +135,17 @@ void DisplaySourceCustomBindings::StartSession(
auth_info = DisplaySourceAuthInfo::FromValue(*auth_info_val);
}
+ DisplaySourceSessionParams session_params;
+ session_params.sink_id = sink_id;
+ session_params.video_track = video_track;
+ session_params.audio_track = audio_track;
+ session_params.render_frame = context()->GetRenderFrame();
+ if (auth_info) {
+ session_params.auth_method = auth_info->method;
+ session_params.auth_data = auth_info->data ? *auth_info->data : "";
+ }
scoped_ptr<DisplaySourceSession> session =
- DisplaySourceSessionFactory::CreateSession(
- sink_id, video_track, audio_track, std::move(auth_info));
+ DisplaySourceSessionFactory::CreateSession(session_params);
if (!session) {
isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(
isolate, kErrorNotSupported)));
@@ -156,8 +164,8 @@ void DisplaySourceCustomBindings::StartSession(
session->SetCallbacks(on_started_callback,
on_terminated_callback,
on_error_callback);
- session_map_.insert(std::make_pair(sink_id, std::move(session)));
session->Start();
+ session_map_.insert(std::make_pair(sink_id, std::move(session)));
}
void DisplaySourceCustomBindings::TerminateSession(
@@ -249,8 +257,10 @@ void DisplaySourceCustomBindings::OnSessionError(int sink_id,
const std::string& message) {
DisplaySourceSession* session = GetDisplaySession(sink_id);
CHECK(session);
- if (session->state() == DisplaySourceSession::Establishing) {
- // Error has occured before the session has actually started.
+ if (session->state() != DisplaySourceSession::Established &&
+ session->state() != DisplaySourceSession::Terminating) {
+ // Error has occured before the session has actually started,
+ // no need to wait for session termination notification.
session_map_.erase(sink_id);
}
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698