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

Side by Side Diff: chrome/browser/policy/device_management_backend_impl.cc

Issue 7324017: Split SystemAccess into TimezoneSettings, StatisticsProvider, and SyslogsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/policy/device_management_backend_impl.h" 5 #include "chrome/browser/policy/device_management_backend_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #if defined(OS_POSIX) && !defined(OS_MACOSX) 10 #if defined(OS_POSIX) && !defined(OS_MACOSX)
11 #include <sys/utsname.h> 11 #include <sys/utsname.h>
12 #endif 12 #endif
13 13
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/sys_info.h" 16 #include "base/sys_info.h"
17 #include "chrome/browser/policy/device_management_service.h" 17 #include "chrome/browser/policy/device_management_service.h"
18 #include "chrome/browser/policy/enterprise_metrics.h" 18 #include "chrome/browser/policy/enterprise_metrics.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "net/base/escape.h" 20 #include "net/base/escape.h"
21 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
22 22
23 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
24 #include "chrome/browser/chromeos/system_access.h" 24 #include "chrome/browser/chromeos/system/statistics_provider.h"
25 #endif 25 #endif
26 26
27 namespace policy { 27 namespace policy {
28 28
29 // Name constants for URL query parameters. 29 // Name constants for URL query parameters.
30 const char DeviceManagementBackendImpl::kParamRequest[] = "request"; 30 const char DeviceManagementBackendImpl::kParamRequest[] = "request";
31 const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype"; 31 const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype";
32 const char DeviceManagementBackendImpl::kParamAppType[] = "apptype"; 32 const char DeviceManagementBackendImpl::kParamAppType[] = "apptype";
33 const char DeviceManagementBackendImpl::kParamDeviceID[] = "deviceid"; 33 const char DeviceManagementBackendImpl::kParamDeviceID[] = "deviceid";
34 const char DeviceManagementBackendImpl::kParamAgent[] = "agent"; 34 const char DeviceManagementBackendImpl::kParamAgent[] = "agent";
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 std::string DeviceManagementBackendImpl::GetPlatformString() { 454 std::string DeviceManagementBackendImpl::GetPlatformString() {
455 static std::string platform; 455 static std::string platform;
456 if (!platform.empty()) 456 if (!platform.empty())
457 return platform; 457 return platform;
458 458
459 std::string os_name(base::SysInfo::OperatingSystemName()); 459 std::string os_name(base::SysInfo::OperatingSystemName());
460 std::string os_hardware(base::SysInfo::CPUArchitecture()); 460 std::string os_hardware(base::SysInfo::CPUArchitecture());
461 461
462 #if defined(OS_CHROMEOS) 462 #if defined(OS_CHROMEOS)
463 chromeos::SystemAccess* sys_lib = chromeos::SystemAccess::GetInstance(); 463 chromeos::system::StatisticsProvider* provider =
464 chromeos::system::StatisticsProvider::GetInstance();
464 465
465 std::string hwclass; 466 std::string hwclass;
466 std::string board; 467 std::string board;
467 if (!sys_lib->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || 468 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) ||
468 !sys_lib->GetMachineStatistic(kMachineInfoBoard, &board)) { 469 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) {
469 LOG(ERROR) << "Failed to get machine information"; 470 LOG(ERROR) << "Failed to get machine information";
470 } 471 }
471 os_name += ",CrOS," + board; 472 os_name += ",CrOS," + board;
472 os_hardware += "," + hwclass; 473 os_hardware += "," + hwclass;
473 #endif 474 #endif
474 475
475 std::string os_version("-"); 476 std::string os_version("-");
476 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 477 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
477 int32 os_major_version = 0; 478 int32 os_major_version = 0;
478 int32 os_minor_version = 0; 479 int32 os_minor_version = 0;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 const std::string& device_id, 528 const std::string& device_id,
528 const em::DevicePolicyRequest& request, 529 const em::DevicePolicyRequest& request,
529 DevicePolicyResponseDelegate* delegate) { 530 DevicePolicyResponseDelegate* delegate) {
530 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchRequested, 531 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchRequested,
531 kMetricPolicySize); 532 kMetricPolicySize);
532 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, 533 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id,
533 request, delegate)); 534 request, delegate));
534 } 535 }
535 536
536 } // namespace policy 537 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | chrome/browser/policy/device_policy_identity_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698