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

Side by Side Diff: remoting/client/chromoting_client.cc

Issue 13932020: Set the initial resolution of an RDP session to the client screen resolution if it is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/client_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "remoting/base/capabilities.h"
8 #include "remoting/client/audio_decode_scheduler.h" 9 #include "remoting/client/audio_decode_scheduler.h"
9 #include "remoting/client/audio_player.h" 10 #include "remoting/client/audio_player.h"
10 #include "remoting/client/client_context.h" 11 #include "remoting/client/client_context.h"
11 #include "remoting/client/client_user_interface.h" 12 #include "remoting/client/client_user_interface.h"
12 #include "remoting/client/rectangle_update_decoder.h" 13 #include "remoting/client/rectangle_update_decoder.h"
13 #include "remoting/proto/audio.pb.h" 14 #include "remoting/proto/audio.pb.h"
14 #include "remoting/proto/video.pb.h" 15 #include "remoting/proto/video.pb.h"
15 #include "remoting/protocol/authentication_method.h" 16 #include "remoting/protocol/authentication_method.h"
16 #include "remoting/protocol/connection_to_host.h" 17 #include "remoting/protocol/connection_to_host.h"
18 #include "remoting/protocol/host_stub.h"
17 #include "remoting/protocol/negotiating_client_authenticator.h" 19 #include "remoting/protocol/negotiating_client_authenticator.h"
18 #include "remoting/protocol/session_config.h" 20 #include "remoting/protocol/session_config.h"
19 #include "remoting/protocol/transport.h" 21 #include "remoting/protocol/transport.h"
20 22
21 namespace remoting { 23 namespace remoting {
22 24
23 using protocol::AuthenticationMethod; 25 using protocol::AuthenticationMethod;
24 26
25 ChromotingClient::ChromotingClient( 27 ChromotingClient::ChromotingClient(
26 const ClientConfig& config, 28 const ClientConfig& config,
27 ClientContext* client_context, 29 ClientContext* client_context,
28 protocol::ConnectionToHost* connection, 30 protocol::ConnectionToHost* connection,
29 ClientUserInterface* user_interface, 31 ClientUserInterface* user_interface,
30 scoped_refptr<FrameConsumerProxy> frame_consumer, 32 scoped_refptr<FrameConsumerProxy> frame_consumer,
31 scoped_ptr<AudioPlayer> audio_player) 33 scoped_ptr<AudioPlayer> audio_player)
32 : config_(config), 34 : config_(config),
33 task_runner_(client_context->main_task_runner()), 35 task_runner_(client_context->main_task_runner()),
34 connection_(connection), 36 connection_(connection),
35 user_interface_(user_interface), 37 user_interface_(user_interface),
38 host_capabilities_received_(false),
36 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 39 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
37 rectangle_decoder_ = 40 rectangle_decoder_ =
38 new RectangleUpdateDecoder(client_context->main_task_runner(), 41 new RectangleUpdateDecoder(client_context->main_task_runner(),
39 client_context->decode_task_runner(), 42 client_context->decode_task_runner(),
40 frame_consumer); 43 frame_consumer);
41 audio_decode_scheduler_.reset(new AudioDecodeScheduler( 44 audio_decode_scheduler_.reset(new AudioDecodeScheduler(
42 client_context->main_task_runner(), 45 client_context->main_task_runner(),
43 client_context->audio_decode_task_runner(), 46 client_context->audio_decode_task_runner(),
44 audio_player.Pass())); 47 audio_player.Pass()));
45 } 48 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 84
82 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) { 85 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) {
83 shutdown_task.Run(); 86 shutdown_task.Run();
84 } 87 }
85 88
86 ChromotingStats* ChromotingClient::GetStats() { 89 ChromotingStats* ChromotingClient::GetStats() {
87 DCHECK(task_runner_->BelongsToCurrentThread()); 90 DCHECK(task_runner_->BelongsToCurrentThread());
88 return rectangle_decoder_->GetStats(); 91 return rectangle_decoder_->GetStats();
89 } 92 }
90 93
94 void ChromotingClient::SetCapabilities(
95 const protocol::Capabilities& capabilities) {
96 DCHECK(task_runner_->BelongsToCurrentThread());
97
98 // Only accept the first |protocol::Capabilities| message.
99 if (host_capabilities_received_) {
100 LOG(WARNING) << "protocol::Capabilities has been received already.";
101 return;
102 }
103
104 host_capabilities_received_ = true;
105 if (capabilities.has_capabilities())
106 host_capabilities_ = capabilities.capabilities();
107
108 VLOG(1) << "Host capabilities: " << host_capabilities_;
109
110 // Calculate the set of capabilities enabled by both client and host and pass
111 // it to the webapp.
112 user_interface_->SetCapabilities(
113 IntersectCapabilities(config_.capabilities, host_capabilities_));
114 }
115
91 void ChromotingClient::InjectClipboardEvent( 116 void ChromotingClient::InjectClipboardEvent(
92 const protocol::ClipboardEvent& event) { 117 const protocol::ClipboardEvent& event) {
93 DCHECK(task_runner_->BelongsToCurrentThread()); 118 DCHECK(task_runner_->BelongsToCurrentThread());
119
94 user_interface_->GetClipboardStub()->InjectClipboardEvent(event); 120 user_interface_->GetClipboardStub()->InjectClipboardEvent(event);
95 } 121 }
96 122
97 void ChromotingClient::SetCursorShape( 123 void ChromotingClient::SetCursorShape(
98 const protocol::CursorShapeInfo& cursor_shape) { 124 const protocol::CursorShapeInfo& cursor_shape) {
125 DCHECK(task_runner_->BelongsToCurrentThread());
126
99 user_interface_->GetCursorShapeStub()->SetCursorShape(cursor_shape); 127 user_interface_->GetCursorShapeStub()->SetCursorShape(cursor_shape);
100 } 128 }
101 129
102 void ChromotingClient::OnConnectionState( 130 void ChromotingClient::OnConnectionState(
103 protocol::ConnectionToHost::State state, 131 protocol::ConnectionToHost::State state,
104 protocol::ErrorCode error) { 132 protocol::ErrorCode error) {
105 DCHECK(task_runner_->BelongsToCurrentThread()); 133 DCHECK(task_runner_->BelongsToCurrentThread());
106 VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")"; 134 VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")";
107 if (state == protocol::ConnectionToHost::AUTHENTICATED) 135 if (state == protocol::ConnectionToHost::AUTHENTICATED)
108 Initialize(); 136 Initialize();
109 user_interface_->OnConnectionState(state, error); 137 user_interface_->OnConnectionState(state, error);
110 } 138 }
111 139
112 void ChromotingClient::OnConnectionReady(bool ready) { 140 void ChromotingClient::OnConnectionReady(bool ready) {
113 VLOG(1) << "ChromotingClient::OnConnectionReady(" << ready << ")"; 141 VLOG(1) << "ChromotingClient::OnConnectionReady(" << ready << ")";
114 user_interface_->OnConnectionReady(ready); 142 user_interface_->OnConnectionReady(ready);
115 } 143 }
116 144
117 void ChromotingClient::Initialize() { 145 void ChromotingClient::Initialize() {
118 DCHECK(task_runner_->BelongsToCurrentThread()); 146 DCHECK(task_runner_->BelongsToCurrentThread());
119 147
120 // Initialize the decoder. 148 // Initialize the decoder.
121 rectangle_decoder_->Initialize(connection_->config()); 149 rectangle_decoder_->Initialize(connection_->config());
122 if (connection_->config().is_audio_enabled()) 150 if (connection_->config().is_audio_enabled())
123 audio_decode_scheduler_->Initialize(connection_->config()); 151 audio_decode_scheduler_->Initialize(connection_->config());
152
153 // Negotiate capabilities with the host.
154 if (connection_->config().SupportsCapabilities()) {
155 VLOG(1) << "Client capabilities: " << config_.capabilities;
156
157 protocol::Capabilities capabilities;
158 capabilities.set_capabilities(config_.capabilities);
159 connection_->host_stub()->SetCapabilities(capabilities);
160 } else {
161 VLOG(1) << "The host does not support any capabilities.";
162
163 host_capabilities_received_ = true;
164 user_interface_->SetCapabilities(host_capabilities_);
165 }
124 } 166 }
125 167
126 } // namespace remoting 168 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/client_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698