OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 static base::LazyInstance<base::Lock>::Leaky | 103 static base::LazyInstance<base::Lock>::Leaky |
104 g_logging_lock = LAZY_INSTANCE_INITIALIZER; | 104 g_logging_lock = LAZY_INSTANCE_INITIALIZER; |
105 | 105 |
106 // String sent in the "hello" message to the plugin to describe features. | 106 // String sent in the "hello" message to the plugin to describe features. |
107 const char ChromotingInstance::kApiFeatures[] = | 107 const char ChromotingInstance::kApiFeatures[] = |
108 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " | 108 "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " |
109 "notifyClientDimensions pauseVideo"; | 109 "notifyClientDimensions pauseVideo"; |
110 | 110 |
111 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, | 111 bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, |
112 ClientConfig* config) { | 112 ClientConfig* config) { |
113 std::vector<std::string> auth_methods; | 113 if (auth_methods_str == "v1_token") { |
114 base::SplitString(auth_methods_str, ',', &auth_methods); | 114 config->use_v1_authenticator = true; |
115 for (std::vector<std::string>::iterator it = auth_methods.begin(); | 115 } else { |
116 it != auth_methods.end(); ++it) { | 116 config->use_v1_authenticator = false; |
117 protocol::AuthenticationMethod authentication_method = | 117 |
118 protocol::AuthenticationMethod::FromString(*it); | 118 std::vector<std::string> auth_methods; |
119 if (authentication_method.is_valid()) | 119 base::SplitString(auth_methods_str, ',', &auth_methods); |
120 config->authentication_methods.push_back(authentication_method); | 120 for (std::vector<std::string>::iterator it = auth_methods.begin(); |
121 } | 121 it != auth_methods.end(); ++it) { |
122 if (config->authentication_methods.empty()) { | 122 protocol::AuthenticationMethod authentication_method = |
123 LOG(ERROR) << "No valid authentication methods specified."; | 123 protocol::AuthenticationMethod::FromString(*it); |
124 return false; | 124 if (authentication_method.is_valid()) |
| 125 config->authentication_methods.push_back(authentication_method); |
| 126 } |
| 127 if (config->authentication_methods.empty()) { |
| 128 LOG(ERROR) << "No valid authentication methods specified."; |
| 129 return false; |
| 130 } |
125 } | 131 } |
126 | 132 |
127 return true; | 133 return true; |
128 } | 134 } |
129 | 135 |
130 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) | 136 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
131 : pp::InstancePrivate(pp_instance), | 137 : pp::InstancePrivate(pp_instance), |
132 initialized_(false), | 138 initialized_(false), |
133 plugin_message_loop_( | 139 plugin_message_loop_( |
134 new PluginMessageLoopProxy(&plugin_thread_delegate_)), | 140 new PluginMessageLoopProxy(&plugin_thread_delegate_)), |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } | 692 } |
687 g_logging_to_plugin = false; | 693 g_logging_to_plugin = false; |
688 } | 694 } |
689 | 695 |
690 bool ChromotingInstance::IsConnected() { | 696 bool ChromotingInstance::IsConnected() { |
691 return host_connection_.get() && | 697 return host_connection_.get() && |
692 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 698 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
693 } | 699 } |
694 | 700 |
695 } // namespace remoting | 701 } // namespace remoting |
OLD | NEW |