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

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.
34 const char kPropertyReleaseBoard[] = "CHROMEOS_RELEASE_BOARD";
35
36 // Key which corresponds to the board property in JS. 30 // Key which corresponds to the board property in JS.
37 const char kPropertyBoard[] = "board"; 31 const char kPropertyBoard[] = "board";
38 32
39 // Key which corresponds to the board property in JS. 33 // Key which corresponds to the board property in JS.
40 const char kPropertyOwner[] = "isOwner"; 34 const char kPropertyOwner[] = "isOwner";
41 35
42 } // namespace 36 } // namespace
43 37
44 ChromeosInfoPrivateGetFunction::ChromeosInfoPrivateGetFunction() { 38 ChromeosInfoPrivateGetFunction::ChromeosInfoPrivateGetFunction() {
45 } 39 }
(...skipping 16 matching lines...) Expand all
62 SendResponse(true); 56 SendResponse(true);
63 return true; 57 return true;
64 } 58 }
65 59
66 base::Value* ChromeosInfoPrivateGetFunction::GetValue( 60 base::Value* ChromeosInfoPrivateGetFunction::GetValue(
67 const std::string& property_name) { 61 const std::string& property_name) {
68 if (property_name == kPropertyHWID) { 62 if (property_name == kPropertyHWID) {
69 std::string hwid; 63 std::string hwid;
70 chromeos::system::StatisticsProvider* provider = 64 chromeos::system::StatisticsProvider* provider =
71 chromeos::system::StatisticsProvider::GetInstance(); 65 chromeos::system::StatisticsProvider::GetInstance();
72 provider->GetMachineStatistic(kHardwareClass, &hwid); 66 provider->GetMachineStatistic(chromeos::system::kHardwareClass, &hwid);
73 return new base::StringValue(hwid); 67 return new base::StringValue(hwid);
74 } else if (property_name == kPropertyHomeProvider) { 68 } else if (property_name == kPropertyHomeProvider) {
75 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary(); 69 NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary();
76 return new base::StringValue(netlib->GetCellularHomeCarrierId()); 70 return new base::StringValue(netlib->GetCellularHomeCarrierId());
77 } else if (property_name == kPropertyInitialLocale) { 71 } else if (property_name == kPropertyInitialLocale) {
78 return new base::StringValue( 72 return new base::StringValue(
79 chromeos::StartupUtils::GetInitialLocale()); 73 chromeos::StartupUtils::GetInitialLocale());
80 } else if (property_name == kPropertyBoard) { 74 } else if (property_name == kPropertyBoard) {
81 std::string board; 75 std::string board;
82 chromeos::system::StatisticsProvider* provider = 76 chromeos::system::StatisticsProvider* provider =
83 chromeos::system::StatisticsProvider::GetInstance(); 77 chromeos::system::StatisticsProvider::GetInstance();
84 provider->GetMachineStatistic(kPropertyReleaseBoard, &board); 78 provider->GetMachineStatistic(chromeos::system::kMachineInfoBoard, &board);
85 return new base::StringValue(board); 79 return new base::StringValue(board);
86 } else if (property_name == kPropertyOwner) { 80 } else if (property_name == kPropertyOwner) {
87 return Value::CreateBooleanValue( 81 return Value::CreateBooleanValue(
88 chromeos::UserManager::Get()->IsCurrentUserOwner()); 82 chromeos::UserManager::Get()->IsCurrentUserOwner());
89 } 83 }
90 84
91 DLOG(ERROR) << "Unknown property request: " << property_name; 85 DLOG(ERROR) << "Unknown property request: " << property_name;
92 return NULL; 86 return NULL;
93 } 87 }
94 88
95 } // namespace extensions 89 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698