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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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 "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 ChromeosInfoPrivateGetFunction::ChromeosInfoPrivateGetFunction() { 157 ChromeosInfoPrivateGetFunction::ChromeosInfoPrivateGetFunction() {
158 } 158 }
159 159
160 ChromeosInfoPrivateGetFunction::~ChromeosInfoPrivateGetFunction() { 160 ChromeosInfoPrivateGetFunction::~ChromeosInfoPrivateGetFunction() {
161 } 161 }
162 162
163 bool ChromeosInfoPrivateGetFunction::RunAsync() { 163 bool ChromeosInfoPrivateGetFunction::RunAsync() {
164 base::ListValue* list = NULL; 164 base::ListValue* list = NULL;
165 EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &list)); 165 EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &list));
166 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 166 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
167 for (size_t i = 0; i < list->GetSize(); ++i) { 167 for (size_t i = 0; i < list->GetSize(); ++i) {
168 std::string property_name; 168 std::string property_name;
169 EXTENSION_FUNCTION_VALIDATE(list->GetString(i, &property_name)); 169 EXTENSION_FUNCTION_VALIDATE(list->GetString(i, &property_name));
170 base::Value* value = GetValue(property_name); 170 base::Value* value = GetValue(property_name);
171 if (value) 171 if (value)
172 result->Set(property_name, value); 172 result->Set(property_name, value);
173 } 173 }
174 SetResult(result.release()); 174 SetResult(result.release());
175 SendResponse(true); 175 SendResponse(true);
176 return true; 176 return true;
(...skipping 29 matching lines...) Expand all
206 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard()); 206 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard());
207 } else if (property_name == kPropertyOwner) { 207 } else if (property_name == kPropertyOwner) {
208 return new base::FundamentalValue( 208 return new base::FundamentalValue(
209 user_manager::UserManager::Get()->IsCurrentUserOwner()); 209 user_manager::UserManager::Get()->IsCurrentUserOwner());
210 } else if (property_name == kPropertyClientId) { 210 } else if (property_name == kPropertyClientId) {
211 return new base::StringValue(GetClientId()); 211 return new base::StringValue(GetClientId());
212 } else if (property_name == kPropertyTimezone) { 212 } else if (property_name == kPropertyTimezone) {
213 return chromeos::CrosSettings::Get()->GetPref( 213 return chromeos::CrosSettings::Get()->GetPref(
214 chromeos::kSystemTimezone)->DeepCopy(); 214 chromeos::kSystemTimezone)->DeepCopy();
215 } else if (property_name == kPropertySupportedTimezones) { 215 } else if (property_name == kPropertySupportedTimezones) {
216 scoped_ptr<base::ListValue> values = chromeos::system::GetTimezoneList(); 216 std::unique_ptr<base::ListValue> values =
217 chromeos::system::GetTimezoneList();
217 return values.release(); 218 return values.release();
218 } else { 219 } else {
219 const char* pref_name = 220 const char* pref_name =
220 GetBoolPrefNameForApiProperty(property_name.c_str()); 221 GetBoolPrefNameForApiProperty(property_name.c_str());
221 if (pref_name) { 222 if (pref_name) {
222 return new base::FundamentalValue( 223 return new base::FundamentalValue(
223 Profile::FromBrowserContext(context_)->GetPrefs()->GetBoolean( 224 Profile::FromBrowserContext(context_)->GetPrefs()->GetBoolean(
224 pref_name)); 225 pref_name));
225 } 226 }
226 } 227 }
(...skipping 27 matching lines...) Expand all
254 } else { 255 } else {
255 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); 256 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name);
256 return false; 257 return false;
257 } 258 }
258 } 259 }
259 260
260 return true; 261 return true;
261 } 262 }
262 263
263 } // namespace extensions 264 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/ime_menu_event_router.cc ('k') | chrome/browser/chromeos/extensions/input_method_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698