| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ios/facade/host_info.h" | 5 #include "remoting/client/ios/facade/host_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 | 10 |
| 11 HostInfo::HostInfo() {} | 11 HostInfo::HostInfo() {} |
| 12 | 12 |
| 13 HostInfo::HostInfo(const HostInfo& other) = default; | 13 HostInfo::HostInfo(const HostInfo& other) = default; |
| 14 | 14 |
| 15 HostInfo::~HostInfo() {} | 15 HostInfo::~HostInfo() {} |
| 16 | 16 |
| 17 bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) { | 17 bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) { |
| 18 const base::ListValue* list_value = nullptr; | 18 const base::ListValue* list_value = nullptr; |
| 19 | 19 |
| 20 // Add TokenUrlPatterns to HostInfo. | 20 // Add TokenUrlPatterns to HostInfo. |
| 21 if (host_info.GetList("tokenUrlPatterns", &list_value)) { | 21 if (host_info.GetList("tokenUrlPatterns", &list_value)) { |
| 22 if (!list_value->empty()) { | 22 if (!list_value->empty()) { |
| 23 for (const auto& item : *list_value) { | 23 for (const auto& item : *list_value) { |
| 24 std::string token_url_pattern; | 24 std::string token_url_pattern; |
| 25 if (!item->GetAsString(&token_url_pattern)) { | 25 if (!item.GetAsString(&token_url_pattern)) { |
| 26 return false; | 26 return false; |
| 27 } | 27 } |
| 28 token_url_patterns.push_back(token_url_pattern); | 28 token_url_patterns.push_back(token_url_pattern); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 std::string response_status; | 33 std::string response_status; |
| 34 host_info.GetString("status", &response_status); | 34 host_info.GetString("status", &response_status); |
| 35 if (response_status == "ONLINE") { | 35 if (response_status == "ONLINE") { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 host_info.GetString("hostOfflineReason", &offline_reason); | 67 host_info.GetString("hostOfflineReason", &offline_reason); |
| 68 | 68 |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool HostInfo::IsReadyForConnection() const { | 72 bool HostInfo::IsReadyForConnection() const { |
| 73 return !host_jid.empty() && status == kHostStatusOnline; | 73 return !host_jid.empty() && status == kHostStatusOnline; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace remoting | 76 } // namespace remoting |
| OLD | NEW |