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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 std::string home_provider_id; | 174 std::string home_provider_id; |
175 if (cellular_device) | 175 if (cellular_device) |
176 home_provider_id = cellular_device->home_provider_id(); | 176 home_provider_id = cellular_device->home_provider_id(); |
177 return new base::StringValue(home_provider_id); | 177 return new base::StringValue(home_provider_id); |
178 } else if (property_name == kPropertyInitialLocale) { | 178 } else if (property_name == kPropertyInitialLocale) { |
179 return new base::StringValue( | 179 return new base::StringValue( |
180 chromeos::StartupUtils::GetInitialLocale()); | 180 chromeos::StartupUtils::GetInitialLocale()); |
181 } else if (property_name == kPropertyBoard) { | 181 } else if (property_name == kPropertyBoard) { |
182 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard()); | 182 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard()); |
183 } else if (property_name == kPropertyOwner) { | 183 } else if (property_name == kPropertyOwner) { |
184 return base::Value::CreateBooleanValue( | 184 return new base::FundamentalValue( |
185 chromeos::UserManager::Get()->IsCurrentUserOwner()); | 185 chromeos::UserManager::Get()->IsCurrentUserOwner()); |
186 } else if (property_name == kPropertyClientId) { | 186 } else if (property_name == kPropertyClientId) { |
187 return new base::StringValue(GetClientId()); | 187 return new base::StringValue(GetClientId()); |
188 } else if (property_name == kPropertyTimezone) { | 188 } else if (property_name == kPropertyTimezone) { |
189 return chromeos::CrosSettings::Get()->GetPref( | 189 return chromeos::CrosSettings::Get()->GetPref( |
190 chromeos::kSystemTimezone)->DeepCopy(); | 190 chromeos::kSystemTimezone)->DeepCopy(); |
191 } else if (property_name == kPropertySupportedTimezones) { | 191 } else if (property_name == kPropertySupportedTimezones) { |
192 scoped_ptr<base::ListValue> values = chromeos::system::GetTimezoneList(); | 192 scoped_ptr<base::ListValue> values = chromeos::system::GetTimezoneList(); |
193 return values.release(); | 193 return values.release(); |
194 } else { | 194 } else { |
195 const char* pref_name = | 195 const char* pref_name = |
196 GetBoolPrefNameForApiProperty(property_name.c_str()); | 196 GetBoolPrefNameForApiProperty(property_name.c_str()); |
197 if (pref_name) { | 197 if (pref_name) { |
198 return base::Value::CreateBooleanValue( | 198 return new base::FundamentalValue( |
199 Profile::FromBrowserContext(context_)->GetPrefs()->GetBoolean( | 199 Profile::FromBrowserContext(context_)->GetPrefs()->GetBoolean( |
200 pref_name)); | 200 pref_name)); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 DLOG(ERROR) << "Unknown property request: " << property_name; | 204 DLOG(ERROR) << "Unknown property request: " << property_name; |
205 return NULL; | 205 return NULL; |
206 } | 206 } |
207 | 207 |
208 ChromeosInfoPrivateSetFunction::ChromeosInfoPrivateSetFunction() { | 208 ChromeosInfoPrivateSetFunction::ChromeosInfoPrivateSetFunction() { |
(...skipping 21 matching lines...) Expand all Loading... |
230 } else { | 230 } else { |
231 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); | 231 error_ = ErrorUtils::FormatErrorMessage(kPropertyNotFound, param_name); |
232 return false; | 232 return false; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 return true; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 } // namespace extensions | 239 } // namespace extensions |
OLD | NEW |