Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: remoting/ios/facade/host_info.cc

Issue 2912293003: [CRD iOS] Consistent host list order and showing last online time (Closed)
Patch Set: Fix comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ios/facade/host_info.h" 5 #include "remoting/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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (!host_info.GetString("hostId", &host_id)) { 44 if (!host_info.GetString("hostId", &host_id)) {
45 LOG(ERROR) << "hostId was not found in host_info"; 45 LOG(ERROR) << "hostId was not found in host_info";
46 return false; 46 return false;
47 } 47 }
48 48
49 if (!host_info.GetString("hostName", &host_name)) { 49 if (!host_info.GetString("hostName", &host_name)) {
50 LOG(ERROR) << "hostName was not found in host_info"; 50 LOG(ERROR) << "hostName was not found in host_info";
51 return false; 51 return false;
52 } 52 }
53 53
54 if (!host_info.GetString("hostOS", &host_os)) {
55 LOG(ERROR) << "hostOS was not found in host_info";
56 return false;
57 }
58
59 if (!host_info.GetString("hostOsVersion", &host_os_version)) {
60 LOG(ERROR) << "hostOsVersion was not found in host_info";
61 return false;
62 }
63
64 if (!host_info.GetString("hostVersion", &host_version)) {
65 LOG(ERROR) << "hostVersion was not found in host_info";
66 return false;
67 }
68
69 if (!host_info.GetString("publicKey", &public_key)) { 54 if (!host_info.GetString("publicKey", &public_key)) {
70 LOG(ERROR) << "publicKey was not found for " << host_name; 55 LOG(ERROR) << "publicKey was not found for " << host_name;
71 return false; 56 return false;
72 } 57 }
73 58
74 // If the host entry was created but the host was never online, then the jid 59 // If the host entry was created but the host was never online, then the jid
75 // is never set. 60 // is never set.
76 if (!host_info.GetString("jabberId", &host_jid) && 61 if (!host_info.GetString("jabberId", &host_jid) &&
77 status == kHostStatusOnline) { 62 status == kHostStatusOnline) {
78 LOG(ERROR) << host_name << " is online but is missing a jabberId"; 63 LOG(ERROR) << host_name << " is online but is missing a jabberId";
79 return false; 64 return false;
80 } 65 }
81 66
67 std::string updated_time_iso;
68 if (host_info.GetString("updatedTime", &updated_time_iso)) {
69 if (!base::Time::FromString(updated_time_iso.c_str(), &updated_time)) {
70 LOG(WARNING) << "Failed to parse updatedTime";
71 }
72 }
73
74 host_info.GetString("hostOs", &host_os);
75 host_info.GetString("hostOsVersion", &host_os_version);
76 host_info.GetString("hostVersion", &host_version);
77
82 host_info.GetString("hostOfflineReason", &offline_reason); 78 host_info.GetString("hostOfflineReason", &offline_reason);
83 79
84 return true; 80 return true;
85 } 81 }
86 82
87 bool HostInfo::IsReadyForConnection() const { 83 bool HostInfo::IsReadyForConnection() const {
88 return !host_jid.empty() && status == kHostStatusOnline; 84 return !host_jid.empty() && status == kHostStatusOnline;
89 } 85 }
90 86
91 } // namespace remoting 87 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698