| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/chromeos/system_settings_provider.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 STLDeleteElements(&timezones_); | 194 STLDeleteElements(&timezones_); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) { | 197 void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) { |
| 198 // Non-guest users can change the time zone. | 198 // Non-guest users can change the time zone. |
| 199 if (UserManager::Get()->IsLoggedInAsGuest()) | 199 if (UserManager::Get()->IsLoggedInAsGuest()) |
| 200 return; | 200 return; |
| 201 | 201 |
| 202 if (path == kSystemTimezone) { | 202 if (path == kSystemTimezone) { |
| 203 string16 value; | 203 string16 value; |
| 204 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || | 204 if (!in_value || !in_value->IsString() || !in_value->GetAsString(&value)) |
| 205 !in_value->GetAsString(&value)) | |
| 206 return; | 205 return; |
| 207 const icu::TimeZone* timezone = GetTimezone(value); | 206 const icu::TimeZone* timezone = GetTimezone(value); |
| 208 if (!timezone) | 207 if (!timezone) |
| 209 return; | 208 return; |
| 210 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); | 209 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); |
| 211 } | 210 } |
| 212 } | 211 } |
| 213 | 212 |
| 214 bool SystemSettingsProvider::Get(const std::string& path, | 213 bool SystemSettingsProvider::Get(const std::string& path, |
| 215 Value** out_value) const { | 214 Value** out_value) const { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 const icu::TimeZone* known_timezone = *iter; | 306 const icu::TimeZone* known_timezone = *iter; |
| 308 if (known_timezone->hasSameRules(timezone)) | 307 if (known_timezone->hasSameRules(timezone)) |
| 309 return GetTimezoneID(*known_timezone); | 308 return GetTimezoneID(*known_timezone); |
| 310 } | 309 } |
| 311 | 310 |
| 312 // Not able to find a matching timezone in our list. | 311 // Not able to find a matching timezone in our list. |
| 313 return string16(); | 312 return string16(); |
| 314 } | 313 } |
| 315 | 314 |
| 316 } // namespace chromeos | 315 } // namespace chromeos |
| OLD | NEW |