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

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: CR feedback #2 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
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,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) { 84 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) {
83 shutdown_task.Run(); 85 shutdown_task.Run();
84 } 86 }
85 87
86 ChromotingStats* ChromotingClient::GetStats() { 88 ChromotingStats* ChromotingClient::GetStats() {
87 DCHECK(task_runner_->BelongsToCurrentThread()); 89 DCHECK(task_runner_->BelongsToCurrentThread());
88 return rectangle_decoder_->GetStats(); 90 return rectangle_decoder_->GetStats();
89 } 91 }
90 92
93 void ChromotingClient::SetCapabilities(
94 const protocol::Capabilities& capabilities) {
95 DCHECK(task_runner_->BelongsToCurrentThread());
96
97 // Only accept the first |protocol::Capabilities| message.
98 if (host_capabilities_) {
99 LOG(WARNING) << "protocol::Capabilities has been received already.";
100 return;
101 }
102
103 host_capabilities_ = make_scoped_ptr(new Capabilities());
104 if (host_capabilities_->FromProtocolMessage(capabilities)) {
105 VLOG(1) << "Host capabilities: " << host_capabilities_->ToString();
106 } else {
107 LOG(ERROR) << "Invalid protocol::Capabilities received.";
108 }
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 host_capabilities_->Intersect(config_.capabilities).ToString());
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::CONNECTED) 135 if (state == protocol::ConnectionToHost::CONNECTED)
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().supports_capabilities()) {
155 VLOG(1) << "Client capabilities: " << config_.capabilities.ToString();
156 connection_->host_stub()->SetCapabilities(
157 *config_.capabilities.ToProtocolMessage());
Sergey Ulanov 2013/04/16 08:38:53 Should we send intersection of capabilities suppor
alexeypa (please no reviews) 2013/04/16 22:06:11 We do. |config_.capabilities| is a combination of
158 } else {
159 VLOG(1) << "The host does not support any capabilities.";
160 host_capabilities_ = make_scoped_ptr(new Capabilities());
161 user_interface_->SetCapabilities(host_capabilities_->ToString());
162 }
124 } 163 }
125 164
126 } // namespace remoting 165 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698