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

Side by Side Diff: extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc

Issue 2132003002: [chrome.displaySource] Use InterfaceProvider instead of ServiceRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/renderer/api/display_source/wifi_display/wifi_display_sessi on.h" 5 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_sessi on.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
11 #include "content/public/common/service_registry.h"
12 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
13 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media _manager.h" 12 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media _manager.h"
13 #include "services/shell/public/cpp/interface_provider.h"
14 #include "third_party/wds/src/libwds/public/logging.h" 14 #include "third_party/wds/src/libwds/public/logging.h"
15 #include "third_party/wds/src/libwds/public/media_manager.h" 15 #include "third_party/wds/src/libwds/public/media_manager.h"
16 16
17 namespace { 17 namespace {
18 const char kErrorInternal[] = "An internal error has occurred"; 18 const char kErrorInternal[] = "An internal error has occurred";
19 const char kErrorTimeout[] = "Sink became unresponsive"; 19 const char kErrorTimeout[] = "Sink became unresponsive";
20 20
21 static void LogWDSError(const char* format, ...) { 21 static void LogWDSError(const char* format, ...) {
22 va_list args; 22 va_list args;
23 va_start(args, format); 23 va_start(args, format);
(...skipping 11 matching lines...) Expand all
35 35
36 WiFiDisplaySession::WiFiDisplaySession( 36 WiFiDisplaySession::WiFiDisplaySession(
37 const DisplaySourceSessionParams& params) 37 const DisplaySourceSessionParams& params)
38 : binding_(this), 38 : binding_(this),
39 params_(params), 39 params_(params),
40 cseq_(0), 40 cseq_(0),
41 timer_id_(0), 41 timer_id_(0),
42 weak_factory_(this) { 42 weak_factory_(this) {
43 DCHECK(params_.render_frame); 43 DCHECK(params_.render_frame);
44 wds::LogSystem::set_error_func(&LogWDSError); 44 wds::LogSystem::set_error_func(&LogWDSError);
45 params.render_frame->GetServiceRegistry()->ConnectToRemoteService( 45 params.render_frame->GetRemoteInterfaces()->GetInterface(&service_);
46 mojo::GetProxy(&service_));
47 service_.set_connection_error_handler(base::Bind( 46 service_.set_connection_error_handler(base::Bind(
48 &WiFiDisplaySession::OnIPCConnectionError, 47 &WiFiDisplaySession::OnIPCConnectionError,
49 weak_factory_.GetWeakPtr())); 48 weak_factory_.GetWeakPtr()));
50 49
51 service_->SetClient(binding_.CreateInterfacePtrAndBind()); 50 service_->SetClient(binding_.CreateInterfacePtrAndBind());
52 binding_.set_connection_error_handler(base::Bind( 51 binding_.set_connection_error_handler(base::Bind(
53 &WiFiDisplaySession::OnIPCConnectionError, 52 &WiFiDisplaySession::OnIPCConnectionError,
54 weak_factory_.GetWeakPtr())); 53 weak_factory_.GetWeakPtr()));
55 } 54 }
56 55
(...skipping 20 matching lines...) Expand all
77 76
78 void WiFiDisplaySession::OnConnected(const mojo::String& local_ip_address, 77 void WiFiDisplaySession::OnConnected(const mojo::String& local_ip_address,
79 const mojo::String& sink_ip_address) { 78 const mojo::String& sink_ip_address) {
80 DCHECK_EQ(DisplaySourceSession::Established, state_); 79 DCHECK_EQ(DisplaySourceSession::Established, state_);
81 local_ip_address_ = local_ip_address; 80 local_ip_address_ = local_ip_address;
82 media_manager_.reset( 81 media_manager_.reset(
83 new WiFiDisplayMediaManager( 82 new WiFiDisplayMediaManager(
84 params_.video_track, 83 params_.video_track,
85 params_.audio_track, 84 params_.audio_track,
86 sink_ip_address, 85 sink_ip_address,
87 params_.render_frame->GetServiceRegistry(), 86 params_.render_frame->GetRemoteInterfaces(),
88 base::Bind( 87 base::Bind(
89 &WiFiDisplaySession::OnMediaError, 88 &WiFiDisplaySession::OnMediaError,
90 weak_factory_.GetWeakPtr()))); 89 weak_factory_.GetWeakPtr())));
91 wfd_source_.reset(wds::Source::Create(this, media_manager_.get(), this)); 90 wfd_source_.reset(wds::Source::Create(this, media_manager_.get(), this));
92 wfd_source_->Start(); 91 wfd_source_->Start();
93 } 92 }
94 93
95 void WiFiDisplaySession::OnConnectRequestHandled(bool success, 94 void WiFiDisplaySession::OnConnectRequestHandled(bool success,
96 const mojo::String& error) { 95 const mojo::String& error) {
97 DCHECK_EQ(DisplaySourceSession::Establishing, state_); 96 DCHECK_EQ(DisplaySourceSession::Establishing, state_);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 217 }
219 218
220 void WiFiDisplaySession::RunTerminateCallback( 219 void WiFiDisplaySession::RunTerminateCallback(
221 bool success, 220 bool success,
222 const std::string& error_message) { 221 const std::string& error_message) {
223 if (!teminate_completion_callback_.is_null()) 222 if (!teminate_completion_callback_.is_null())
224 teminate_completion_callback_.Run(success, error_message); 223 teminate_completion_callback_.Run(success, error_message);
225 } 224 }
226 225
227 } // namespace extensions 226 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698