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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
10 #include "base/values.h" | 12 #include "base/values.h" |
11 #include "chrome/browser/app_mode/app_mode_utils.h" | 13 #include "chrome/browser/app_mode/app_mode_utils.h" |
12 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/login/startup_utils.h" | 15 #include "chrome/browser/chromeos/login/startup_utils.h" |
14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
16 #include "chrome/browser/chromeos/system/timezone_util.h" | 18 #include "chrome/browser/chromeos/system/timezone_util.h" |
17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 base::ListValue* list = NULL; | 166 base::ListValue* list = NULL; |
165 EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &list)); | 167 EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &list)); |
166 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 168 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
167 for (size_t i = 0; i < list->GetSize(); ++i) { | 169 for (size_t i = 0; i < list->GetSize(); ++i) { |
168 std::string property_name; | 170 std::string property_name; |
169 EXTENSION_FUNCTION_VALIDATE(list->GetString(i, &property_name)); | 171 EXTENSION_FUNCTION_VALIDATE(list->GetString(i, &property_name)); |
170 base::Value* value = GetValue(property_name); | 172 base::Value* value = GetValue(property_name); |
171 if (value) | 173 if (value) |
172 result->Set(property_name, value); | 174 result->Set(property_name, value); |
173 } | 175 } |
174 SetResult(result.release()); | 176 SetResult(std::move(result)); |
175 SendResponse(true); | 177 SendResponse(true); |
176 return true; | 178 return true; |
177 } | 179 } |
178 | 180 |
179 base::Value* ChromeosInfoPrivateGetFunction::GetValue( | 181 base::Value* ChromeosInfoPrivateGetFunction::GetValue( |
180 const std::string& property_name) { | 182 const std::string& property_name) { |
181 if (property_name == kPropertyHWID) { | 183 if (property_name == kPropertyHWID) { |
182 std::string hwid; | 184 std::string hwid; |
183 chromeos::system::StatisticsProvider* provider = | 185 chromeos::system::StatisticsProvider* provider = |
184 chromeos::system::StatisticsProvider::GetInstance(); | 186 chromeos::system::StatisticsProvider::GetInstance(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } else { | 257 } else { |
256 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); | 258 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); |
257 return false; | 259 return false; |
258 } | 260 } |
259 } | 261 } |
260 | 262 |
261 return true; | 263 return true; |
262 } | 264 } |
263 | 265 |
264 } // namespace extensions | 266 } // namespace extensions |
OLD | NEW |