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

Side by Side Diff: remoting/protocol/session_config.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: fixed remoting_unittests 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/protocol/session_config.h" 5 #include "remoting/protocol/session_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace remoting { 9 namespace remoting {
10 namespace protocol { 10 namespace protocol {
11 11
12 const int kDefaultStreamVersion = 2; 12 const int kDefaultStreamVersion = 2;
13 13
14 // The control channel version that supports the "capabilities" message.
15 const int kCapabilitiesControlStreamVersion = 3;
Sergey Ulanov 2013/04/18 00:34:53 I think it's better to have kControlStreamVersion=
alexeypa (please no reviews) 2013/04/18 18:56:36 Done.
16
14 ChannelConfig ChannelConfig::None() { 17 ChannelConfig ChannelConfig::None() {
15 return ChannelConfig(); 18 return ChannelConfig();
16 } 19 }
17 20
18 ChannelConfig::ChannelConfig() 21 ChannelConfig::ChannelConfig()
19 : transport(TRANSPORT_NONE), 22 : transport(TRANSPORT_NONE),
20 version(0), 23 version(0),
21 codec(CODEC_UNDEFINED) { 24 codec(CODEC_UNDEFINED) {
22 } 25 }
23 26
24 ChannelConfig::ChannelConfig(TransportType transport, int version, Codec codec) 27 ChannelConfig::ChannelConfig(TransportType transport, int version, Codec codec)
25 : transport(transport), 28 : transport(transport),
26 version(version), 29 version(version),
27 codec(codec) { 30 codec(codec) {
28 } 31 }
29 32
30 bool ChannelConfig::operator==(const ChannelConfig& b) const { 33 bool ChannelConfig::operator==(const ChannelConfig& b) const {
31 // If the transport field is set to NONE then all other fields are irrelevant. 34 // If the transport field is set to NONE then all other fields are irrelevant.
32 if (transport == ChannelConfig::TRANSPORT_NONE) 35 if (transport == ChannelConfig::TRANSPORT_NONE)
33 return transport == b.transport; 36 return transport == b.transport;
34 return transport == b.transport && version == b.version && codec == b.codec; 37 return transport == b.transport && version == b.version && codec == b.codec;
35 } 38 }
36 39
37 SessionConfig::SessionConfig() { 40 SessionConfig::SessionConfig() {
41 }
38 42
43 bool SessionConfig::SupportsCapabilities() const {
44 return control_config_.version >= kCapabilitiesControlStreamVersion;
39 } 45 }
40 46
41 // static 47 // static
42 SessionConfig SessionConfig::ForTest() { 48 SessionConfig SessionConfig::ForTest() {
43 SessionConfig result; 49 SessionConfig result;
44 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 50 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
45 kDefaultStreamVersion, 51 kDefaultStreamVersion,
46 ChannelConfig::CODEC_UNDEFINED)); 52 ChannelConfig::CODEC_UNDEFINED));
47 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 53 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
48 kDefaultStreamVersion, 54 kDefaultStreamVersion,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return result.Pass(); 170 return result.Pass();
165 } 171 }
166 172
167 // static 173 // static
168 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() { 174 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() {
169 scoped_ptr<CandidateSessionConfig> result = CreateEmpty(); 175 scoped_ptr<CandidateSessionConfig> result = CreateEmpty();
170 176
171 // Control channel. 177 // Control channel.
172 result->mutable_control_configs()->push_back( 178 result->mutable_control_configs()->push_back(
173 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, 179 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM,
180 kCapabilitiesControlStreamVersion,
181 ChannelConfig::CODEC_UNDEFINED));
182 result->mutable_control_configs()->push_back(
183 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM,
174 kDefaultStreamVersion, 184 kDefaultStreamVersion,
175 ChannelConfig::CODEC_UNDEFINED)); 185 ChannelConfig::CODEC_UNDEFINED));
176 result->mutable_control_configs()->push_back( 186 result->mutable_control_configs()->push_back(
177 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 187 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
178 kDefaultStreamVersion, 188 kDefaultStreamVersion,
179 ChannelConfig::CODEC_UNDEFINED)); 189 ChannelConfig::CODEC_UNDEFINED));
180 190
181 // Event channel. 191 // Event channel.
182 result->mutable_event_configs()->push_back( 192 result->mutable_event_configs()->push_back(
183 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, 193 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 228
219 // static 229 // static
220 void CandidateSessionConfig::DisableAudioChannel( 230 void CandidateSessionConfig::DisableAudioChannel(
221 CandidateSessionConfig* config) { 231 CandidateSessionConfig* config) {
222 config->mutable_audio_configs()->clear(); 232 config->mutable_audio_configs()->clear();
223 config->mutable_audio_configs()->push_back(ChannelConfig()); 233 config->mutable_audio_configs()->push_back(ChannelConfig());
224 } 234 }
225 235
226 } // namespace protocol 236 } // namespace protocol
227 } // namespace remoting 237 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698