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

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: crossystem command changed from is_in_vm to inside_vm 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
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
131 // VMs. This info will be used to filter out error messages on VMs. See
132 // http://crbug.com/585514 and http://crbug.com/585515 for more info.
133 std::string system_vendor; 130 std::string system_vendor;
134 stats->GetMachineStatistic(chromeos::system::kSystemVendorKey, 131 stats->GetMachineStatistic(chromeos::system::kSystemVendorKey,
135 &system_vendor); 132 &system_vendor);
136 std::string firmware_type; 133 if (!chromeos::system::isRunningOnChromeOSVM()) {
Daniel Erat 2016/08/10 13:58:05 s/is/Is/ (see style guide)
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 << "'. " 134 LOG(ERROR) << "Machine has malformed HWID '" << hwid << "'. "
147 << "The system vendor is '" << system_vendor << "'."; 135 << "The system vendor is '" << system_vendor << "'.";
148 return false; 136 return false;
137 } else {
138 LOG(WARNING) << "The system is a VM. The system vendor is '"
139 << system_vendor << "'.";
149 } 140 }
150 } 141 }
151 return true; 142 return true;
152 } 143 }
153 144
154 } // namespace chromeos 145 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/system/statistics_provider.h » ('j') | chromeos/system/statistics_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698