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

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

Issue 14643006: [chromeos] Remove dependencies of StatisticsProvider on chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots Created 7 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 (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/chromeos/system/statistics_provider.h" 5 #include "chrome/browser/chromeos/system/statistics_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/chromeos/chromeos_version.h" 8 #include "base/chromeos/chromeos_version.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "chrome/browser/chromeos/app_mode/kiosk_oem_manifest_parser.h" 18 #include "chromeos/app_mode/kiosk_oem_manifest_parser.h"
19 #include "chrome/browser/chromeos/system/name_value_pairs_parser.h" 19 #include "chromeos/chromeos_constants.h"
20 #include "chrome/common/child_process_logging.h"
21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_version_info.h"
24 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
21 #include "chromeos/system/name_value_pairs_parser.h"
25 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
26 23
27 using content::BrowserThread; 24 using content::BrowserThread;
28 25
29 namespace chromeos { 26 namespace chromeos {
30 namespace system { 27 namespace system {
31 namespace { 28 namespace {
32 29
33 // 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
34 // format of the tool. 31 // format of the tool.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 void StatisticsProviderImpl::LoadMachineOSInfoFile() { 186 void StatisticsProviderImpl::LoadMachineOSInfoFile() {
190 NameValuePairsParser parser(&machine_info_); 187 NameValuePairsParser parser(&machine_info_);
191 if (parser.GetNameValuePairsFromFile(base::FilePath(kMachineOSInfoFile), 188 if (parser.GetNameValuePairsFromFile(base::FilePath(kMachineOSInfoFile),
192 kMachineOSInfoEq, 189 kMachineOSInfoEq,
193 kMachineOSInfoDelim)) { 190 kMachineOSInfoDelim)) {
194 #if defined(GOOGLE_CHROME_BUILD) 191 #if defined(GOOGLE_CHROME_BUILD)
195 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; 192 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK";
196 NameValuePairsParser::NameValueMap::iterator iter = 193 NameValuePairsParser::NameValueMap::iterator iter =
197 machine_info_.find(kChromeOSReleaseTrack); 194 machine_info_.find(kChromeOSReleaseTrack);
198 if (iter != machine_info_.end()) 195 if (iter != machine_info_.end())
199 chrome::VersionInfo::SetChannel(iter->second); 196 chrome::VersionInfo::SetChannel(iter->second);
hshi1 2013/05/02 20:30:08 This is still using chrome::
200 #endif 197 #endif
201 } 198 }
202 } 199 }
203 200
204 void StatisticsProviderImpl::StartLoadingMachineStatistics() { 201 void StatisticsProviderImpl::StartLoadingMachineStatistics() {
205 DCHECK(initialized_); 202 DCHECK(initialized_);
206 DCHECK(!load_statistics_started_); 203 DCHECK(!load_statistics_started_);
207 load_statistics_started_ = true; 204 load_statistics_started_ = true;
208 205
209 VLOG(1) << "Started loading statistics"; 206 VLOG(1) << "Started loading statistics";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 on_statistics_loaded_.Signal(); 241 on_statistics_loaded_.Signal();
245 VLOG(1) << "Finished loading statistics"; 242 VLOG(1) << "Finished loading statistics";
246 } 243 }
247 244
248 void StatisticsProviderImpl::LoadOemManifestFromFile( 245 void StatisticsProviderImpl::LoadOemManifestFromFile(
249 const base::FilePath& file) { 246 const base::FilePath& file) {
250 KioskOemManifestParser::Manifest oem_manifest; 247 KioskOemManifestParser::Manifest oem_manifest;
251 if (!KioskOemManifestParser::Load(file, &oem_manifest)) 248 if (!KioskOemManifestParser::Load(file, &oem_manifest))
252 return; 249 return;
253 250
254 machine_info_[chrome::kOemDeviceRequisitionKey] = 251 machine_info_[chromeos::kOemDeviceRequisitionKey] =
255 oem_manifest.device_requisition; 252 oem_manifest.device_requisition;
256 machine_flags_[chrome::kOemIsEnterpriseManagedKey] = 253 machine_flags_[chromeos::kOemIsEnterpriseManagedKey] =
257 oem_manifest.enterprise_managed; 254 oem_manifest.enterprise_managed;
258 machine_flags_[chrome::kOemCanExitEnterpriseEnrollmentKey] = 255 machine_flags_[chromeos::kOemCanExitEnterpriseEnrollmentKey] =
259 oem_manifest.can_exit_enrollment; 256 oem_manifest.can_exit_enrollment;
260 machine_flags_[chrome::kOemKeyboardDrivenOobeKey] = 257 machine_flags_[chromeos::kOemKeyboardDrivenOobeKey] =
261 oem_manifest.keyboard_driven_oobe; 258 oem_manifest.keyboard_driven_oobe;
262 } 259 }
263 260
264 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { 261 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() {
265 return Singleton<StatisticsProviderImpl, 262 return Singleton<StatisticsProviderImpl,
266 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); 263 DefaultSingletonTraits<StatisticsProviderImpl> >::get();
267 } 264 }
268 265
269 // The stub StatisticsProvider implementation used on Linux desktop. 266 // The stub StatisticsProvider implementation used on Linux desktop.
270 class StatisticsProviderStubImpl : public StatisticsProviderImpl { 267 class StatisticsProviderStubImpl : public StatisticsProviderImpl {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 StatisticsProvider* StatisticsProvider::GetInstance() { 316 StatisticsProvider* StatisticsProvider::GetInstance() {
320 if (base::chromeos::IsRunningOnChromeOS()) { 317 if (base::chromeos::IsRunningOnChromeOS()) {
321 return StatisticsProviderImpl::GetInstance(); 318 return StatisticsProviderImpl::GetInstance();
322 } else { 319 } else {
323 return StatisticsProviderStubImpl::GetInstance(); 320 return StatisticsProviderStubImpl::GetInstance();
324 } 321 }
325 } 322 }
326 323
327 } // namespace system 324 } // namespace system
328 } // namespace chromeos 325 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698