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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/dom_ui/system_settings_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/system_settings_provider.h" 5 #include "chrome/browser/chromeos/dom_ui/system_settings_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 const icu::TimeZone* timezone = GetTimezone(value); 207 const icu::TimeZone* timezone = GetTimezone(value);
208 if (!timezone) 208 if (!timezone)
209 return; 209 return;
210 CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); 210 CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone);
211 } 211 }
212 } 212 }
213 213
214 bool SystemSettingsProvider::Get(const std::string& path, 214 bool SystemSettingsProvider::Get(const std::string& path,
215 Value** out_value) const { 215 Value** out_value) const {
216 if (path == kSystemTimezone) { 216 if (path == kSystemTimezone) {
217 *out_value = Value::CreateStringValue( 217 *out_value = Value::CreateStringValue(GetKnownTimezoneID(
218 GetTimezoneID(CrosLibrary::Get()->GetSystemLibrary()->GetTimezone())); 218 CrosLibrary::Get()->GetSystemLibrary()->GetTimezone()));
219 return true; 219 return true;
220 } 220 }
221 return false; 221 return false;
222 } 222 }
223 223
224 bool SystemSettingsProvider::HandlesSetting(const std::string& path) { 224 bool SystemSettingsProvider::HandlesSetting(const std::string& path) {
225 return ::StartsWithASCII(path, std::string("cros.system."), true); 225 return ::StartsWithASCII(path, std::string("cros.system."), true);
226 } 226 }
227 227
228 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { 228 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 for (std::vector<icu::TimeZone*>::iterator iter = timezones_.begin(); 293 for (std::vector<icu::TimeZone*>::iterator iter = timezones_.begin();
294 iter != timezones_.end(); ++iter) { 294 iter != timezones_.end(); ++iter) {
295 const icu::TimeZone* timezone = *iter; 295 const icu::TimeZone* timezone = *iter;
296 if (GetTimezoneID(*timezone) == timezone_id) { 296 if (GetTimezoneID(*timezone) == timezone_id) {
297 return timezone; 297 return timezone;
298 } 298 }
299 } 299 }
300 return NULL; 300 return NULL;
301 } 301 }
302 302
303 string16 SystemSettingsProvider::GetKnownTimezoneID(
304 const icu::TimeZone& timezone) const {
305 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones_.begin();
306 iter != timezones_.end(); ++iter) {
307 const icu::TimeZone* known_timezone = *iter;
308 if (known_timezone->hasSameRules(timezone))
309 return GetTimezoneID(*known_timezone);
310 }
311
312 // Not able to find a matching timezone in our list.
313 return string16();
314 }
315
303 } // namespace chromeos 316 } // namespace chromeos
OLDNEW
« 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