Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/host_info.h" | 5 #include "remoting/test/host_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | |
| 10 const char kChromotingAuthenticationMethods[] = | |
| 11 "spake2_pair,spake2_plain,spake2_hmac,third_party"; | |
| 12 } | |
| 13 | |
| 9 namespace remoting { | 14 namespace remoting { |
| 10 namespace test { | 15 namespace test { |
| 11 | 16 |
| 12 HostInfo::HostInfo() { | 17 HostInfo::HostInfo() { |
| 13 } | 18 } |
| 14 | 19 |
| 15 HostInfo::~HostInfo() { | 20 HostInfo::~HostInfo() { |
| 16 } | 21 } |
| 17 | 22 |
| 18 bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) { | 23 bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 status == kHostStatusOnline) { | 68 status == kHostStatusOnline) { |
| 64 LOG(ERROR) << host_name << " is online but is missing a jabberId"; | 69 LOG(ERROR) << host_name << " is online but is missing a jabberId"; |
| 65 return false; | 70 return false; |
| 66 } | 71 } |
| 67 | 72 |
| 68 host_info.GetString("hostOfflineReason", &offline_reason); | 73 host_info.GetString("hostOfflineReason", &offline_reason); |
| 69 | 74 |
| 70 return true; | 75 return true; |
| 71 } | 76 } |
| 72 | 77 |
| 78 bool HostInfo::IsReadyForConnection() const { | |
| 79 return status == kHostStatusOnline; | |
|
anandc
2015/07/15 21:12:29
If all this is doing is this 1 check, why have a s
tonychun
2015/07/16 23:12:08
Done.
| |
| 80 } | |
| 81 | |
| 82 ConnectionInfo HostInfo::GenerateConnectionInfo( | |
| 83 const std::string& access_token, | |
| 84 const std::string& user_name, | |
| 85 const std::string& pin) const { | |
| 86 ConnectionInfo connection_info; | |
| 87 connection_info.access_token = access_token; | |
| 88 connection_info.auth_methods_str = kChromotingAuthenticationMethods; | |
| 89 connection_info.host_id = host_id; | |
| 90 connection_info.host_jid = host_jid; | |
| 91 connection_info.host_name = host_name; | |
| 92 connection_info.pin = pin; | |
| 93 connection_info.public_key = public_key; | |
| 94 connection_info.user_name = user_name; | |
| 95 | |
| 96 return connection_info; | |
| 97 } | |
| 98 | |
| 73 } // namespace test | 99 } // namespace test |
| 74 } // namespace remoting | 100 } // namespace remoting |
| OLD | NEW |