OLD | NEW |
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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 using chromeos::NetworkHandler; | 26 using chromeos::NetworkHandler; |
27 | 27 |
28 namespace extensions { | 28 namespace extensions { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Key which corresponds to the HWID setting. | 32 // Key which corresponds to the HWID setting. |
33 const char kPropertyHWID[] = "hwid"; | 33 const char kPropertyHWID[] = "hwid"; |
34 | 34 |
| 35 // Key which corresponds to the customization ID setting. |
| 36 const char kPropertyCustomizationID[] = "customizationId"; |
| 37 |
35 // Key which corresponds to the home provider property. | 38 // Key which corresponds to the home provider property. |
36 const char kPropertyHomeProvider[] = "homeProvider"; | 39 const char kPropertyHomeProvider[] = "homeProvider"; |
37 | 40 |
38 // Key which corresponds to the initial_locale property. | 41 // Key which corresponds to the initial_locale property. |
39 const char kPropertyInitialLocale[] = "initialLocale"; | 42 const char kPropertyInitialLocale[] = "initialLocale"; |
40 | 43 |
41 // Key which corresponds to the board property in JS. | 44 // Key which corresponds to the board property in JS. |
42 const char kPropertyBoard[] = "board"; | 45 const char kPropertyBoard[] = "board"; |
43 | 46 |
44 // Key which corresponds to the board property in JS. | 47 // Key which corresponds to the board property in JS. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 122 } |
120 | 123 |
121 base::Value* ChromeosInfoPrivateGetFunction::GetValue( | 124 base::Value* ChromeosInfoPrivateGetFunction::GetValue( |
122 const std::string& property_name) { | 125 const std::string& property_name) { |
123 if (property_name == kPropertyHWID) { | 126 if (property_name == kPropertyHWID) { |
124 std::string hwid; | 127 std::string hwid; |
125 chromeos::system::StatisticsProvider* provider = | 128 chromeos::system::StatisticsProvider* provider = |
126 chromeos::system::StatisticsProvider::GetInstance(); | 129 chromeos::system::StatisticsProvider::GetInstance(); |
127 provider->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid); | 130 provider->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid); |
128 return new base::StringValue(hwid); | 131 return new base::StringValue(hwid); |
| 132 } else if (property_name == kPropertyCustomizationID) { |
| 133 std::string customization_id; |
| 134 chromeos::system::StatisticsProvider* provider = |
| 135 chromeos::system::StatisticsProvider::GetInstance(); |
| 136 provider->GetMachineStatistic(chromeos::system::kCustomizationIdKey, |
| 137 &customization_id); |
| 138 return new base::StringValue(customization_id); |
129 } else if (property_name == kPropertyHomeProvider) { | 139 } else if (property_name == kPropertyHomeProvider) { |
130 const chromeos::DeviceState* cellular_device = | 140 const chromeos::DeviceState* cellular_device = |
131 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( | 141 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( |
132 chromeos::NetworkTypePattern::Cellular()); | 142 chromeos::NetworkTypePattern::Cellular()); |
133 std::string home_provider_id; | 143 std::string home_provider_id; |
134 if (cellular_device) | 144 if (cellular_device) |
135 home_provider_id = cellular_device->home_provider_id(); | 145 home_provider_id = cellular_device->home_provider_id(); |
136 return new base::StringValue(home_provider_id); | 146 return new base::StringValue(home_provider_id); |
137 } else if (property_name == kPropertyInitialLocale) { | 147 } else if (property_name == kPropertyInitialLocale) { |
138 return new base::StringValue( | 148 return new base::StringValue( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } else { | 197 } else { |
188 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); | 198 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); |
189 return false; | 199 return false; |
190 } | 200 } |
191 } | 201 } |
192 | 202 |
193 return true; | 203 return true; |
194 } | 204 } |
195 | 205 |
196 } // namespace extensions | 206 } // namespace extensions |
OLD | NEW |