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

Side by Side Diff: chrome/browser/chromeos/extensions/info_private_api.cc

Issue 17010003: Cleanup of system settings constants (ab)use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/extensions/info_private_api.h" 5 #include "chrome/browser/chromeos/extensions/info_private_api.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/cros/network_library.h" 9 #include "chrome/browser/chromeos/cros/network_library.h"
10 #include "chrome/browser/chromeos/login/startup_utils.h" 10 #include "chrome/browser/chromeos/login/startup_utils.h"
11 #include "chrome/browser/chromeos/login/user_manager.h" 11 #include "chrome/browser/chromeos/login/user_manager.h"
12 #include "chrome/browser/chromeos/system/statistics_provider.h" 12 #include "chrome/browser/chromeos/system/statistics_provider.h"
13 13
14 using chromeos::CrosLibrary; 14 using chromeos::CrosLibrary;
15 using chromeos::NetworkLibrary; 15 using chromeos::NetworkLibrary;
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 namespace { 19 namespace {
20 20
21 // Name of machine statistic property with HWID.
22 const char kHardwareClass[] = "hardware_class";
23
24 // Key which corresponds to the HWID setting. 21 // Key which corresponds to the HWID setting.
25 const char kPropertyHWID[] = "hwid"; 22 const char kPropertyHWID[] = "hwid";
26 23
27 // Key which corresponds to the home provider property. 24 // Key which corresponds to the home provider property.
28 const char kPropertyHomeProvider[] = "homeProvider"; 25 const char kPropertyHomeProvider[] = "homeProvider";
29 26
30 // Key which corresponds to the initial_locale property. 27 // Key which corresponds to the initial_locale property.
31 const char kPropertyInitialLocale[] = "initialLocale"; 28 const char kPropertyInitialLocale[] = "initialLocale";
32 29
33 // Name of machine statistic property with board. 30 // Name of machine statistic property with board.
(...skipping 28 matching lines...) Expand all
62 SendResponse(true); 59 SendResponse(true);
63 return true; 60 return true;
64 } 61 }
65 62
66 base::Value* ChromeosInfoPrivateGetFunction::GetValue( 63 base::Value* ChromeosInfoPrivateGetFunction::GetValue(
67 const std::string& property_name) { 64 const std::string& property_name) {
68 if (property_name == kPropertyHWID) { 65 if (property_name == kPropertyHWID) {
69 std::string hwid; 66 std::string hwid;
70 chromeos::system::StatisticsProvider* provider = 67 chromeos::system::StatisticsProvider* provider =
71 chromeos::system::StatisticsProvider::GetInstance(); 68 chromeos::system::StatisticsProvider::GetInstance();
72 provider->GetMachineStatistic(kHardwareClass, &hwid); 69 provider->GetMachineStatistic(chromeos::system::kHardwareClass, &hwid);
73 return new base::StringValue(hwid); 70 return new base::StringValue(hwid);
74 } else if (property_name == kPropertyHomeProvider) { 71 } else if (property_name == kPropertyHomeProvider) {
75 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary(); 72 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary();
76 return new base::StringValue(netlib->GetCellularHomeCarrierId()); 73 return new base::StringValue(netlib->GetCellularHomeCarrierId());
77 } else if (property_name == kPropertyInitialLocale) { 74 } else if (property_name == kPropertyInitialLocale) {
78 return new base::StringValue( 75 return new base::StringValue(
79 chromeos::StartupUtils::GetInitialLocale()); 76 chromeos::StartupUtils::GetInitialLocale());
80 } else if (property_name == kPropertyBoard) { 77 } else if (property_name == kPropertyBoard) {
81 std::string board; 78 std::string board;
82 chromeos::system::StatisticsProvider* provider = 79 chromeos::system::StatisticsProvider* provider =
83 chromeos::system::StatisticsProvider::GetInstance(); 80 chromeos::system::StatisticsProvider::GetInstance();
84 provider->GetMachineStatistic(kPropertyReleaseBoard, &board); 81 provider->GetMachineStatistic(chromeos::system::kMachineInfoBoard, &board);
85 return new base::StringValue(board); 82 return new base::StringValue(board);
86 } else if (property_name == kPropertyOwner) { 83 } else if (property_name == kPropertyOwner) {
87 return Value::CreateBooleanValue( 84 return Value::CreateBooleanValue(
88 chromeos::UserManager::Get()->IsCurrentUserOwner()); 85 chromeos::UserManager::Get()->IsCurrentUserOwner());
89 } 86 }
90 87
91 DLOG(ERROR) << "Unknown property request: " << property_name; 88 DLOG(ERROR) << "Unknown property request: " << property_name;
92 return NULL; 89 return NULL;
93 } 90 }
94 91
95 } // namespace extensions 92 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698