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

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

Issue 240903002: Add consumer_device_management_service() in BrowserPolicyConnectorChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/policy/device_management_service_configuration.h"
6
7 #include "base/strings/stringprintf.h"
8 #include "base/sys_info.h"
9 #include "chrome/common/chrome_version_info.h"
10 #include "components/policy/core/browser/browser_policy_connector.h"
11
12 #if defined(OS_CHROMEOS)
13 #include "chromeos/system/statistics_provider.h"
14 #endif
15
16 namespace policy {
17
18 DeviceManagementServiceConfiguration::DeviceManagementServiceConfiguration(
19 const std::string& server_url) : server_url_(server_url) {}
bartfab (slow) 2014/04/25 09:17:35 Nit: This violates the style guide: If entire meth
davidyu 2014/04/28 02:58:22 Done.
20
21 DeviceManagementServiceConfiguration::~DeviceManagementServiceConfiguration() {}
bartfab (slow) 2014/04/25 09:17:35 Nit: The closing brace should go on its own line.
davidyu 2014/04/28 02:58:22 Done.
22
23 std::string DeviceManagementServiceConfiguration::GetServerUrl() {
24 return server_url_;
25 }
26
27 std::string DeviceManagementServiceConfiguration::GetAgentParameter() {
28 chrome::VersionInfo version_info;
29 return base::StringPrintf("%s %s(%s)",
30 version_info.Name().c_str(),
31 version_info.Version().c_str(),
32 version_info.LastChange().c_str());
33 }
34
35 std::string DeviceManagementServiceConfiguration::GetPlatformParameter() {
36 std::string os_name = base::SysInfo::OperatingSystemName();
37 std::string os_hardware = base::SysInfo::OperatingSystemArchitecture();
38
39 #if defined(OS_CHROMEOS)
40 chromeos::system::StatisticsProvider* provider =
41 chromeos::system::StatisticsProvider::GetInstance();
42
43 std::string hwclass;
44 if (!provider->GetMachineStatistic(chromeos::system::kHardwareClassKey,
45 &hwclass)) {
46 LOG(ERROR) << "Failed to get machine information";
bartfab (slow) 2014/04/25 09:17:35 Nit: #include "base/logging.h"
davidyu 2014/04/28 02:58:22 Done.
47 }
48 os_name += ",CrOS," + base::SysInfo::GetLsbReleaseBoard();
49 os_hardware += "," + hwclass;
50 #endif
51
52 std::string os_version("-");
53 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
54 int32 os_major_version = 0;
bartfab (slow) 2014/04/25 09:17:35 Nit: #include "base/basictypes.h"
davidyu 2014/04/28 02:58:22 Done.
55 int32 os_minor_version = 0;
56 int32 os_bugfix_version = 0;
57 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
58 &os_minor_version,
59 &os_bugfix_version);
60 os_version = base::StringPrintf("%d.%d.%d",
61 os_major_version,
62 os_minor_version,
63 os_bugfix_version);
64 #endif
65
66 return base::StringPrintf(
67 "%s|%s|%s", os_name.c_str(), os_hardware.c_str(), os_version.c_str());
68 }
69
70 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698