| 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/host/plugin/host_script_object.h" | 5 #include "remoting/host/plugin/host_script_object.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); | 995 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
| 996 | 996 |
| 997 if (!success) { | 997 if (!success) { |
| 998 SetState(kError); | 998 SetState(kError); |
| 999 DisconnectInternal(); | 999 DisconnectInternal(); |
| 1000 return; | 1000 return; |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 std::string host_secret = GenerateSupportHostSecret(); | 1003 std::string host_secret = GenerateSupportHostSecret(); |
| 1004 std::string access_code = support_id + host_secret; | 1004 std::string access_code = support_id + host_secret; |
| 1005 |
| 1006 std::string local_certificate = host_key_pair_.GenerateCertificate(); |
| 1007 if (local_certificate.empty()) { |
| 1008 LOG(ERROR) << "Failed to generate host certificate."; |
| 1009 SetState(kError); |
| 1010 DisconnectInternal(); |
| 1011 return; |
| 1012 } |
| 1013 |
| 1005 scoped_ptr<protocol::AuthenticatorFactory> factory( | 1014 scoped_ptr<protocol::AuthenticatorFactory> factory( |
| 1006 new protocol::It2MeHostAuthenticatorFactory( | 1015 new protocol::It2MeHostAuthenticatorFactory( |
| 1007 host_key_pair_.GenerateCertificate(), *host_key_pair_.private_key(), | 1016 local_certificate, *host_key_pair_.private_key(), access_code)); |
| 1008 access_code)); | |
| 1009 host_->SetAuthenticatorFactory(factory.Pass()); | 1017 host_->SetAuthenticatorFactory(factory.Pass()); |
| 1010 | 1018 |
| 1011 { | 1019 { |
| 1012 base::AutoLock lock(access_code_lock_); | 1020 base::AutoLock lock(access_code_lock_); |
| 1013 access_code_ = access_code; | 1021 access_code_ = access_code; |
| 1014 access_code_lifetime_ = lifetime; | 1022 access_code_lifetime_ = lifetime; |
| 1015 } | 1023 } |
| 1016 | 1024 |
| 1017 SetState(kReceivedAccessCode); | 1025 SetState(kReceivedAccessCode); |
| 1018 } | 1026 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 return is_good; | 1313 return is_good; |
| 1306 } | 1314 } |
| 1307 | 1315 |
| 1308 void HostNPScriptObject::SetException(const std::string& exception_string) { | 1316 void HostNPScriptObject::SetException(const std::string& exception_string) { |
| 1309 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 1317 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 1310 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); | 1318 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); |
| 1311 LOG(INFO) << exception_string; | 1319 LOG(INFO) << exception_string; |
| 1312 } | 1320 } |
| 1313 | 1321 |
| 1314 } // namespace remoting | 1322 } // namespace remoting |
| OLD | NEW |