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

Side by Side Diff: chromeos/system/statistics_provider.cc

Issue 258743005: Enable Enterprise enrollment on desktop builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added arg to PathService::OverrideAndCreateIfNeeded, added test for FakeCryptohomeClient::InstallAt… Created 6 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chromeos/system/statistics_provider.h" 5 #include "chromeos/system/statistics_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 19 matching lines...) Expand all
30 // Path to the tool used to get system info, and delimiters for the output 30 // Path to the tool used to get system info, and delimiters for the output
31 // format of the tool. 31 // format of the tool.
32 const char* kCrosSystemTool[] = { "/usr/bin/crossystem" }; 32 const char* kCrosSystemTool[] = { "/usr/bin/crossystem" };
33 const char kCrosSystemEq[] = "="; 33 const char kCrosSystemEq[] = "=";
34 const char kCrosSystemDelim[] = "\n"; 34 const char kCrosSystemDelim[] = "\n";
35 const char kCrosSystemCommentDelim[] = "#"; 35 const char kCrosSystemCommentDelim[] = "#";
36 const char kCrosSystemUnknownValue[] = "(error)"; 36 const char kCrosSystemUnknownValue[] = "(error)";
37 37
38 const char kHardwareClassCrosSystemKey[] = "hwid"; 38 const char kHardwareClassCrosSystemKey[] = "hwid";
39 const char kUnknownHardwareClass[] = "unknown"; 39 const char kUnknownHardwareClass[] = "unknown";
40 const char kSerialNumber[] = "sn";
40 41
41 // File to get machine hardware info from, and key/value delimiters of 42 // File to get machine hardware info from, and key/value delimiters of
42 // the file. 43 // the file.
43 // /tmp/machine-info is generated by platform/init/chromeos_startup. 44 // /tmp/machine-info is generated by platform/init/chromeos_startup.
44 const char kMachineHardwareInfoFile[] = "/tmp/machine-info"; 45 const char kMachineHardwareInfoFile[] = "/tmp/machine-info";
45 const char kMachineHardwareInfoEq[] = "="; 46 const char kMachineHardwareInfoEq[] = "=";
46 const char kMachineHardwareInfoDelim[] = " \n"; 47 const char kMachineHardwareInfoDelim[] = " \n";
47 48
48 // File to get ECHO coupon info from, and key/value delimiters of 49 // File to get ECHO coupon info from, and key/value delimiters of
49 // the file. 50 // the file.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 CommandLine* command_line = CommandLine::ForCurrentProcess(); 263 CommandLine* command_line = CommandLine::ForCurrentProcess();
263 if (command_line->HasSwitch(switches::kAppOemManifestFile)) { 264 if (command_line->HasSwitch(switches::kAppOemManifestFile)) {
264 LoadOemManifestFromFile( 265 LoadOemManifestFromFile(
265 command_line->GetSwitchValuePath(switches::kAppOemManifestFile)); 266 command_line->GetSwitchValuePath(switches::kAppOemManifestFile));
266 } else if (base::SysInfo::IsRunningOnChromeOS()) { 267 } else if (base::SysInfo::IsRunningOnChromeOS()) {
267 LoadOemManifestFromFile(base::FilePath(kOemManifestFilePath)); 268 LoadOemManifestFromFile(base::FilePath(kOemManifestFilePath));
268 } 269 }
269 oem_manifest_loaded_ = true; 270 oem_manifest_loaded_ = true;
270 } 271 }
271 272
273 if (!base::SysInfo::IsRunningOnChromeOS() &&
274 machine_info_.find(kSerialNumber) == machine_info_.end()) {
275 // Set stub value for testing.
276 machine_info_[kSerialNumber] = "stub_serial_number";
277 }
278
272 // Finished loading the statistics. 279 // Finished loading the statistics.
273 on_statistics_loaded_.Signal(); 280 on_statistics_loaded_.Signal();
274 VLOG(1) << "Finished loading statistics."; 281 VLOG(1) << "Finished loading statistics.";
275 } 282 }
276 283
277 void StatisticsProviderImpl::LoadOemManifestFromFile( 284 void StatisticsProviderImpl::LoadOemManifestFromFile(
278 const base::FilePath& file) { 285 const base::FilePath& file) {
279 // Called from LoadMachineStatistics. Check cancellation_flag_ again here. 286 // Called from LoadMachineStatistics. Check cancellation_flag_ again here.
280 if (cancellation_flag_.IsSet()) 287 if (cancellation_flag_.IsSet())
281 return; 288 return;
(...skipping 29 matching lines...) Expand all
311 return StatisticsProviderImpl::GetInstance(); 318 return StatisticsProviderImpl::GetInstance();
312 } 319 }
313 320
314 // static 321 // static
315 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { 322 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) {
316 g_test_statistics_provider = test_provider; 323 g_test_statistics_provider = test_provider;
317 } 324 }
318 325
319 } // namespace system 326 } // namespace system
320 } // namespace chromeos 327 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698