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

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

Issue 819133004: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 bool IsHWIDCorrect(const std::string& hwid) { 106 bool IsHWIDCorrect(const std::string& hwid) {
107 return IsCorrectHWIDv2(hwid) || IsCorrectExceptionalHWID(hwid) || 107 return IsCorrectHWIDv2(hwid) || IsCorrectExceptionalHWID(hwid) ||
108 IsCorrectHWIDv3(hwid); 108 IsCorrectHWIDv3(hwid);
109 } 109 }
110 110
111 bool IsMachineHWIDCorrect() { 111 bool IsMachineHWIDCorrect() {
112 #if !defined(GOOGLE_CHROME_BUILD) 112 #if !defined(GOOGLE_CHROME_BUILD)
113 return true; 113 return true;
114 #endif 114 #endif
115 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 115 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
116 if (cmd_line->HasSwitch(::switches::kTestType)) 116 if (cmd_line->HasSwitch(::switches::kTestType))
117 return true; 117 return true;
118 if (!base::SysInfo::IsRunningOnChromeOS()) 118 if (!base::SysInfo::IsRunningOnChromeOS())
119 return true; 119 return true;
120 std::string hwid; 120 std::string hwid;
121 chromeos::system::StatisticsProvider* stats = 121 chromeos::system::StatisticsProvider* stats =
122 chromeos::system::StatisticsProvider::GetInstance(); 122 chromeos::system::StatisticsProvider::GetInstance();
123 if (!stats->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid)) { 123 if (!stats->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid)) {
124 LOG(ERROR) << "Couldn't get machine statistic 'hardware_class'."; 124 LOG(ERROR) << "Couldn't get machine statistic 'hardware_class'.";
125 return false; 125 return false;
126 } 126 }
127 if (!chromeos::IsHWIDCorrect(hwid)) { 127 if (!chromeos::IsHWIDCorrect(hwid)) {
128 LOG(ERROR) << "Machine has malformed HWID '" << hwid << "'."; 128 LOG(ERROR) << "Machine has malformed HWID '" << hwid << "'.";
129 return false; 129 return false;
130 } 130 }
131 return true; 131 return true;
132 } 132 }
133 133
134 } // namespace chromeos 134 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/chromeos/login/kiosk_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698