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

Side by Side Diff: chrome/browser/chromeos/login/hwid_checker.cc

Issue 2218703006: Clean up handling of invalid HWID when running ChromeOS in VMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/hwid_checker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/login/hwid_checker.h" 5 #include "chrome/browser/chromeos/login/hwid_checker.h"
6 6
7 #include <cstdio> 7 #include <cstdio>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return true; 120 return true;
121 chromeos::system::StatisticsProvider* stats = 121 chromeos::system::StatisticsProvider* stats =
122 chromeos::system::StatisticsProvider::GetInstance(); 122 chromeos::system::StatisticsProvider::GetInstance();
123 123
124 std::string hwid; 124 std::string hwid;
125 if (!stats->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid)) { 125 if (!stats->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid)) {
126 LOG(ERROR) << "Couldn't get machine statistic 'hardware_class'."; 126 LOG(ERROR) << "Couldn't get machine statistic 'hardware_class'.";
127 return false; 127 return false;
128 } 128 }
129 if (!chromeos::IsHWIDCorrect(hwid)) { 129 if (!chromeos::IsHWIDCorrect(hwid)) {
130 // Log the system vendor info to see what the system vendor is on the GCE 130 if (stats->IsRunningOnVm()) {
achuithb 2016/08/12 20:39:02 Does this need to be nested inside the !IsHWIDCorr
norvez 2016/08/13 00:06:59 Dunno, that order looks right to me. The complete
achuithb 2016/08/15 17:15:05 No, to be honest I would prefer this to be moved t
norvez 2016/08/16 10:36:19 Done.
131 // VMs. This info will be used to filter out error messages on VMs. See 131 return true;
132 // http://crbug.com/585514 and http://crbug.com/585515 for more info.
133 std::string system_vendor;
134 stats->GetMachineStatistic(chromeos::system::kSystemVendorKey,
135 &system_vendor);
136 std::string firmware_type;
137 const bool non_chrome_firmware =
138 stats->GetMachineStatistic(chromeos::system::kFirmwareTypeKey,
139 &firmware_type) &&
140 firmware_type == system::kFirmwareTypeValueNonchrome;
141 if (non_chrome_firmware) {
142 LOG(WARNING) << "Detected non-Chrome firmware with malformed HWID '"
143 << hwid << "', assuming VM environment. "
144 << "The system vendor is '" << system_vendor << "'.";
145 } else {
146 LOG(ERROR) << "Machine has malformed HWID '" << hwid << "'. "
147 << "The system vendor is '" << system_vendor << "'.";
148 return false;
149 } 132 }
133 LOG(ERROR) << "Machine has malformed HWID '" << hwid << "'. ";
134 return false;
150 } 135 }
151 return true; 136 return true;
152 } 137 }
153 138
154 } // namespace chromeos 139 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/hwid_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698