| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 12 matching lines...) Expand all Loading... |
| 23 #include "ppapi/cpp/private/var_private.h" | 23 #include "ppapi/cpp/private/var_private.h" |
| 24 #include "remoting/base/util.h" | 24 #include "remoting/base/util.h" |
| 25 #include "remoting/client/client_config.h" | 25 #include "remoting/client/client_config.h" |
| 26 #include "remoting/client/chromoting_client.h" | 26 #include "remoting/client/chromoting_client.h" |
| 27 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 27 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
| 28 #include "remoting/client/plugin/pepper_input_handler.h" | 28 #include "remoting/client/plugin/pepper_input_handler.h" |
| 29 #include "remoting/client/plugin/pepper_view.h" | 29 #include "remoting/client/plugin/pepper_view.h" |
| 30 #include "remoting/client/plugin/pepper_view_proxy.h" | 30 #include "remoting/client/plugin/pepper_view_proxy.h" |
| 31 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 31 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
| 32 #include "remoting/client/rectangle_update_decoder.h" | 32 #include "remoting/client/rectangle_update_decoder.h" |
| 33 #include "remoting/proto/auth.pb.h" | |
| 34 #include "remoting/protocol/connection_to_host.h" | 33 #include "remoting/protocol/connection_to_host.h" |
| 35 #include "remoting/protocol/host_stub.h" | 34 #include "remoting/protocol/host_stub.h" |
| 36 | 35 |
| 37 namespace remoting { | 36 namespace remoting { |
| 38 | 37 |
| 39 // This flag blocks LOGs to the UI if we're already in the middle of logging | 38 // This flag blocks LOGs to the UI if we're already in the middle of logging |
| 40 // to the UI. This prevents a potential infinite loop if we encounter an error | 39 // to the UI. This prevents a potential infinite loop if we encounter an error |
| 41 // while sending the log message to the UI. | 40 // while sending the log message to the UI. |
| 42 static bool g_logging_to_plugin = false; | 41 static bool g_logging_to_plugin = false; |
| 43 static bool g_has_logging_instance = false; | 42 static bool g_has_logging_instance = false; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 pp::VarPrivate object = GetInstanceObject(); | 270 pp::VarPrivate object = GetInstanceObject(); |
| 272 if (!object.is_undefined()) { | 271 if (!object.is_undefined()) { |
| 273 pp::deprecated::ScriptableObject* so = object.AsScriptableObject(); | 272 pp::deprecated::ScriptableObject* so = object.AsScriptableObject(); |
| 274 DCHECK(so != NULL); | 273 DCHECK(so != NULL); |
| 275 return static_cast<ChromotingScriptableObject*>(so); | 274 return static_cast<ChromotingScriptableObject*>(so); |
| 276 } | 275 } |
| 277 LOG(ERROR) << "Unable to get ScriptableObject for Chromoting plugin."; | 276 LOG(ERROR) << "Unable to get ScriptableObject for Chromoting plugin."; |
| 278 return NULL; | 277 return NULL; |
| 279 } | 278 } |
| 280 | 279 |
| 281 void ChromotingInstance::SubmitLoginInfo(const std::string& username, | |
| 282 const std::string& password) { | |
| 283 if (host_connection_->state() != protocol::ConnectionToHost::CONNECTED) { | |
| 284 LOG(INFO) << "Client not connected or already authenticated."; | |
| 285 return; | |
| 286 } | |
| 287 | |
| 288 protocol::LocalLoginCredentials* credentials = | |
| 289 new protocol::LocalLoginCredentials(); | |
| 290 credentials->set_type(protocol::PASSWORD); | |
| 291 credentials->set_username(username); | |
| 292 credentials->set_credential(password.data(), password.length()); | |
| 293 | |
| 294 host_connection_->host_stub()->BeginSessionRequest( | |
| 295 credentials, | |
| 296 base::Bind(&DeletePointer<protocol::LocalLoginCredentials>, credentials)); | |
| 297 } | |
| 298 | |
| 299 void ChromotingInstance::SetScaleToFit(bool scale_to_fit) { | 280 void ChromotingInstance::SetScaleToFit(bool scale_to_fit) { |
| 300 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | 281 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); |
| 301 | 282 |
| 302 if (scale_to_fit == scale_to_fit_) | 283 if (scale_to_fit == scale_to_fit_) |
| 303 return; | 284 return; |
| 304 | 285 |
| 305 scale_to_fit_ = scale_to_fit; | 286 scale_to_fit_ = scale_to_fit; |
| 306 if (scale_to_fit) { | 287 if (scale_to_fit) { |
| 307 rectangle_decoder_->SetScaleRatios(view_->GetHorizontalScaleRatio(), | 288 rectangle_decoder_->SetScaleRatios(view_->GetHorizontalScaleRatio(), |
| 308 view_->GetVerticalScaleRatio()); | 289 view_->GetVerticalScaleRatio()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 401 |
| 421 void ChromotingInstance::ReleaseAllKeys() { | 402 void ChromotingInstance::ReleaseAllKeys() { |
| 422 if (!input_handler_.get()) { | 403 if (!input_handler_.get()) { |
| 423 return; | 404 return; |
| 424 } | 405 } |
| 425 | 406 |
| 426 input_handler_->ReleaseAllKeys(); | 407 input_handler_->ReleaseAllKeys(); |
| 427 } | 408 } |
| 428 | 409 |
| 429 } // namespace remoting | 410 } // namespace remoting |
| OLD | NEW |