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

Side by Side Diff: chrome/browser/policy/cloud/device_management_service.cc

Issue 23588009: Parse /etc/lsb-release only once on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/policy/cloud/device_management_service.h" 5 #include "chrome/browser/policy/cloud/device_management_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const int kDeviceIdConflict = 409; 68 const int kDeviceIdConflict = 409;
69 const int kDeviceNotFound = 410; 69 const int kDeviceNotFound = 410;
70 const int kPendingApproval = 412; 70 const int kPendingApproval = 412;
71 const int kInternalServerError = 500; 71 const int kInternalServerError = 500;
72 const int kServiceUnavailable = 503; 72 const int kServiceUnavailable = 503;
73 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. 73 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code.
74 74
75 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
76 // Machine info keys. 76 // Machine info keys.
77 const char kMachineInfoHWClass[] = "hardware_class"; 77 const char kMachineInfoHWClass[] = "hardware_class";
78 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD";
79 #endif 78 #endif
80 79
81 bool IsProxyError(const net::URLRequestStatus status) { 80 bool IsProxyError(const net::URLRequestStatus status) {
82 switch (status.error()) { 81 switch (status.error()) {
83 case net::ERR_PROXY_CONNECTION_FAILED: 82 case net::ERR_PROXY_CONNECTION_FAILED:
84 case net::ERR_TUNNEL_CONNECTION_FAILED: 83 case net::ERR_TUNNEL_CONNECTION_FAILED:
85 case net::ERR_PROXY_AUTH_UNSUPPORTED: 84 case net::ERR_PROXY_AUTH_UNSUPPORTED:
86 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: 85 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE:
87 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: 86 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED:
88 case net::ERR_PROXY_CERTIFICATE_INVALID: 87 case net::ERR_PROXY_CERTIFICATE_INVALID:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return platform; 173 return platform;
175 174
176 std::string os_name(base::SysInfo::OperatingSystemName()); 175 std::string os_name(base::SysInfo::OperatingSystemName());
177 std::string os_hardware(base::SysInfo::OperatingSystemArchitecture()); 176 std::string os_hardware(base::SysInfo::OperatingSystemArchitecture());
178 177
179 #if defined(OS_CHROMEOS) 178 #if defined(OS_CHROMEOS)
180 chromeos::system::StatisticsProvider* provider = 179 chromeos::system::StatisticsProvider* provider =
181 chromeos::system::StatisticsProvider::GetInstance(); 180 chromeos::system::StatisticsProvider::GetInstance();
182 181
183 std::string hwclass; 182 std::string hwclass;
184 std::string board; 183 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass))
185 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) ||
186 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) {
187 LOG(ERROR) << "Failed to get machine information"; 184 LOG(ERROR) << "Failed to get machine information";
188 } 185 os_name += ",CrOS," + base::SysInfo::GetLsbReleaseBoard();
189 os_name += ",CrOS," + board;
190 os_hardware += "," + hwclass; 186 os_hardware += "," + hwclass;
191 #endif 187 #endif
192 188
193 std::string os_version("-"); 189 std::string os_version("-");
194 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 190 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
195 int32 os_major_version = 0; 191 int32 os_major_version = 0;
196 int32 os_minor_version = 0; 192 int32 os_minor_version = 0;
197 int32 os_bugfix_version = 0; 193 int32 os_bugfix_version = 0;
198 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, 194 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
199 &os_minor_version, 195 &os_minor_version,
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 642 }
647 } 643 }
648 644
649 const JobQueue::iterator elem = 645 const JobQueue::iterator elem =
650 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 646 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
651 if (elem != queued_jobs_.end()) 647 if (elem != queued_jobs_.end())
652 queued_jobs_.erase(elem); 648 queued_jobs_.erase(elem);
653 } 649 }
654 650
655 } // namespace policy 651 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698