| 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || | 207 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || |
| 208 !in_value->GetAsString(&value)) | 208 !in_value->GetAsString(&value)) |
| 209 return; | 209 return; |
| 210 const icu::TimeZone* timezone = GetTimezone(value); | 210 const icu::TimeZone* timezone = GetTimezone(value); |
| 211 if (!timezone) | 211 if (!timezone) |
| 212 return; | 212 return; |
| 213 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); | 213 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool SystemSettingsProvider::Get(const std::string& path, | 217 const base::Value* SystemSettingsProvider::Get(const std::string& path) const { |
| 218 Value** out_value) const { | |
| 219 if (path == kSystemTimezone) { | 218 if (path == kSystemTimezone) { |
| 220 *out_value = Value::CreateStringValue(GetKnownTimezoneID( | 219 // TODO(pastarmovj): Cache this in the local_state instead of locally. |
| 221 system::TimezoneSettings::GetInstance()->GetTimezone())); | 220 system_timezone_.reset(base::Value::CreateStringValue(GetKnownTimezoneID( |
| 222 return true; | 221 system::TimezoneSettings::GetInstance()->GetTimezone()))); |
| 222 return system_timezone_.get(); |
| 223 } | 223 } |
| 224 return false; | 224 return NULL; |
| 225 } |
| 226 |
| 227 // The timezone is always trusted. |
| 228 bool SystemSettingsProvider::GetTrusted(const std::string& path, |
| 229 const base::Closure& callback) const { |
| 230 return true; |
| 225 } | 231 } |
| 226 | 232 |
| 227 bool SystemSettingsProvider::HandlesSetting(const std::string& path) const { | 233 bool SystemSettingsProvider::HandlesSetting(const std::string& path) const { |
| 228 return path == kSystemTimezone; | 234 return path == kSystemTimezone; |
| 229 } | 235 } |
| 230 | 236 |
| 231 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { | 237 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { |
| 232 // Fires system setting change notification. | 238 // Fires system setting change notification. |
| 233 CrosSettings::Get()->FireObservers(kSystemTimezone); | 239 CrosSettings::Get()->FireObservers(kSystemTimezone); |
| 234 } | 240 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 const icu::TimeZone* known_timezone = *iter; | 316 const icu::TimeZone* known_timezone = *iter; |
| 311 if (known_timezone->hasSameRules(timezone)) | 317 if (known_timezone->hasSameRules(timezone)) |
| 312 return GetTimezoneID(*known_timezone); | 318 return GetTimezoneID(*known_timezone); |
| 313 } | 319 } |
| 314 | 320 |
| 315 // Not able to find a matching timezone in our list. | 321 // Not able to find a matching timezone in our list. |
| 316 return string16(); | 322 return string16(); |
| 317 } | 323 } |
| 318 | 324 |
| 319 } // namespace chromeos | 325 } // namespace chromeos |
| OLD | NEW |