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

Unified Diff: chrome/browser/chromeos/dom_ui/system_settings_provider.cc

Issue 5524002: Use only timezone IDs from known timezone list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/dom_ui/system_settings_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/dom_ui/system_settings_provider.cc
diff --git a/chrome/browser/chromeos/dom_ui/system_settings_provider.cc b/chrome/browser/chromeos/dom_ui/system_settings_provider.cc
index d8b0c104017604e5d490b4bf970eac58c5820fac..fcfa7dc336afb882712209caa0704e3efdc56916 100644
--- a/chrome/browser/chromeos/dom_ui/system_settings_provider.cc
+++ b/chrome/browser/chromeos/dom_ui/system_settings_provider.cc
@@ -214,8 +214,8 @@ void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) {
bool SystemSettingsProvider::Get(const std::string& path,
Value** out_value) const {
if (path == kSystemTimezone) {
- *out_value = Value::CreateStringValue(
- GetTimezoneID(CrosLibrary::Get()->GetSystemLibrary()->GetTimezone()));
+ *out_value = Value::CreateStringValue(GetKnownTimezoneID(
+ CrosLibrary::Get()->GetSystemLibrary()->GetTimezone()));
return true;
}
return false;
@@ -300,4 +300,17 @@ const icu::TimeZone* SystemSettingsProvider::GetTimezone(
return NULL;
}
+string16 SystemSettingsProvider::GetKnownTimezoneID(
+ const icu::TimeZone& timezone) const {
+ for (std::vector<icu::TimeZone*>::const_iterator iter = timezones_.begin();
+ iter != timezones_.end(); ++iter) {
+ const icu::TimeZone* known_timezone = *iter;
+ if (known_timezone->hasSameRules(timezone))
+ return GetTimezoneID(*known_timezone);
+ }
+
+ // Not able to find a matching timezone in our list.
+ return string16();
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/dom_ui/system_settings_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698