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

Side by Side Diff: remoting/client/plugin/chromoting_instance.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/plugin/chromoting_instance.h ('k') | remoting/host/basic_desktop_environment.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/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 base::LazyInstance<scoped_refptr<base::SingleThreadTaskRunner> >::Leaky 130 base::LazyInstance<scoped_refptr<base::SingleThreadTaskRunner> >::Leaky
131 g_logging_task_runner = LAZY_INSTANCE_INITIALIZER; 131 g_logging_task_runner = LAZY_INSTANCE_INITIALIZER;
132 base::LazyInstance<base::WeakPtr<ChromotingInstance> >::Leaky 132 base::LazyInstance<base::WeakPtr<ChromotingInstance> >::Leaky
133 g_logging_instance = LAZY_INSTANCE_INITIALIZER; 133 g_logging_instance = LAZY_INSTANCE_INITIALIZER;
134 base::LazyInstance<base::Lock>::Leaky 134 base::LazyInstance<base::Lock>::Leaky
135 g_logging_lock = LAZY_INSTANCE_INITIALIZER; 135 g_logging_lock = LAZY_INSTANCE_INITIALIZER;
136 logging::LogMessageHandlerFunction g_logging_old_handler = NULL; 136 logging::LogMessageHandlerFunction g_logging_old_handler = NULL;
137 137
138 } // namespace 138 } // namespace
139 139
140 // String sent in the "hello" message to the plugin to describe features. 140 // String sent in the "hello" message to the webapp to describe features.
141 const char ChromotingInstance::kApiFeatures[] = 141 const char ChromotingInstance::kApiFeatures[] =
142 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " 142 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey "
143 "notifyClientDimensions notifyClientResolution pauseVideo pauseAudio " 143 "notifyClientDimensions notifyClientResolution pauseVideo pauseAudio "
144 "asyncPin thirdPartyAuth"; 144 "asyncPin thirdPartyAuth";
145 145
146 const char ChromotingInstance::kRequestedCapabilities[] = "";
147 const char ChromotingInstance::kSupportedCapabilities[] = "";
148
146 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, 149 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str,
147 ClientConfig* config) { 150 ClientConfig* config) {
148 std::vector<std::string> auth_methods; 151 std::vector<std::string> auth_methods;
149 base::SplitString(auth_methods_str, ',', &auth_methods); 152 base::SplitString(auth_methods_str, ',', &auth_methods);
150 for (std::vector<std::string>::iterator it = auth_methods.begin(); 153 for (std::vector<std::string>::iterator it = auth_methods.begin();
151 it != auth_methods.end(); ++it) { 154 it != auth_methods.end(); ++it) {
152 protocol::AuthenticationMethod authentication_method = 155 protocol::AuthenticationMethod authentication_method =
153 protocol::AuthenticationMethod::FromString(*it); 156 protocol::AuthenticationMethod::FromString(*it);
154 if (authentication_method.is_valid()) 157 if (authentication_method.is_valid())
155 config->authentication_methods.push_back(authentication_method); 158 config->authentication_methods.push_back(authentication_method);
(...skipping 28 matching lines...) Expand all
184 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); 187 RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
185 188
186 // Resister this instance to handle debug log messsages. 189 // Resister this instance to handle debug log messsages.
187 RegisterLoggingInstance(); 190 RegisterLoggingInstance();
188 191
189 // Send hello message. 192 // Send hello message.
190 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 193 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
191 data->SetInteger("apiVersion", kApiVersion); 194 data->SetInteger("apiVersion", kApiVersion);
192 data->SetString("apiFeatures", kApiFeatures); 195 data->SetString("apiFeatures", kApiFeatures);
193 data->SetInteger("apiMinVersion", kApiMinMessagingVersion); 196 data->SetInteger("apiMinVersion", kApiMinMessagingVersion);
197 data->SetString("requestedCapabilities", kRequestedCapabilities);
198 data->SetString("supportedCapabilities", kSupportedCapabilities);
199
194 PostChromotingMessage("hello", data.Pass()); 200 PostChromotingMessage("hello", data.Pass());
195 } 201 }
196 202
197 ChromotingInstance::~ChromotingInstance() { 203 ChromotingInstance::~ChromotingInstance() {
198 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 204 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
199 205
200 // Unregister this instance so that debug log messages will no longer be sent 206 // Unregister this instance so that debug log messages will no longer be sent
201 // to it. This will stop all logging in all Chromoting instances. 207 // to it. This will stop all logging in all Chromoting instances.
202 UnregisterLoggingInstance(); 208 UnregisterLoggingInstance();
203 209
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 this->AsWeakPtr()); 296 this->AsWeakPtr());
291 } else { 297 } else {
292 std::string shared_secret; 298 std::string shared_secret;
293 if (!data->GetString("sharedSecret", &shared_secret)) { 299 if (!data->GetString("sharedSecret", &shared_secret)) {
294 LOG(ERROR) << "sharedSecret not specified in connect()."; 300 LOG(ERROR) << "sharedSecret not specified in connect().";
295 return; 301 return;
296 } 302 }
297 config.fetch_secret_callback = 303 config.fetch_secret_callback =
298 base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret); 304 base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret);
299 } 305 }
306
307 // Read the list of capabilities, if any.
308 if (data->HasKey("capabilities")) {
309 if (!data->GetString("capabilities", &config.capabilities)) {
310 LOG(ERROR) << "Invalid connect() data.";
311 return;
312 }
313 }
314
300 Connect(config); 315 Connect(config);
301 } else if (method == "disconnect") { 316 } else if (method == "disconnect") {
302 Disconnect(); 317 Disconnect();
303 } else if (method == "incomingIq") { 318 } else if (method == "incomingIq") {
304 std::string iq; 319 std::string iq;
305 if (!data->GetString("iq", &iq)) { 320 if (!data->GetString("iq", &iq)) {
306 LOG(ERROR) << "Invalid onIq() data."; 321 LOG(ERROR) << "Invalid onIq() data.";
307 return; 322 return;
308 } 323 }
309 OnIncomingIq(iq); 324 OnIncomingIq(iq);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 data->SetString("scope", scope); 486 data->SetString("scope", scope);
472 PostChromotingMessage("fetchThirdPartyToken", data.Pass()); 487 PostChromotingMessage("fetchThirdPartyToken", data.Pass());
473 } 488 }
474 489
475 void ChromotingInstance::OnConnectionReady(bool ready) { 490 void ChromotingInstance::OnConnectionReady(bool ready) {
476 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 491 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
477 data->SetBoolean("ready", ready); 492 data->SetBoolean("ready", ready);
478 PostChromotingMessage("onConnectionReady", data.Pass()); 493 PostChromotingMessage("onConnectionReady", data.Pass());
479 } 494 }
480 495
496 void ChromotingInstance::SetCapabilities(const std::string& capabilities) {
497 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
498 data->SetString("capabilities", capabilities);
499 PostChromotingMessage("setCapabilities", data.Pass());
500 }
501
481 void ChromotingInstance::FetchSecretFromDialog( 502 void ChromotingInstance::FetchSecretFromDialog(
482 const protocol::SecretFetchedCallback& secret_fetched_callback) { 503 const protocol::SecretFetchedCallback& secret_fetched_callback) {
483 // Once the Session object calls this function, it won't continue the 504 // Once the Session object calls this function, it won't continue the
484 // authentication until the callback is called (or connection is canceled). 505 // authentication until the callback is called (or connection is canceled).
485 // So, it's impossible to reach this with a callback already registered. 506 // So, it's impossible to reach this with a callback already registered.
486 DCHECK(secret_fetched_callback_.is_null()); 507 DCHECK(secret_fetched_callback_.is_null());
487 secret_fetched_callback_ = secret_fetched_callback; 508 secret_fetched_callback_ = secret_fetched_callback;
488 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 509 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
489 PostChromotingMessage("fetchPin", data.Pass()); 510 PostChromotingMessage("fetchPin", data.Pass());
490 } 511 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 url_components.scheme.len); 939 url_components.scheme.len);
919 return url_scheme == kChromeExtensionUrlScheme; 940 return url_scheme == kChromeExtensionUrlScheme;
920 } 941 }
921 942
922 bool ChromotingInstance::IsConnected() { 943 bool ChromotingInstance::IsConnected() {
923 return host_connection_.get() && 944 return host_connection_.get() &&
924 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 945 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
925 } 946 }
926 947
927 } // namespace remoting 948 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/host/basic_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698