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/system/timezone_settings.h" | 5 #include "chrome/browser/chromeos/system/timezone_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/chromeos/chromeos_version.h" | 10 #include "base/chromeos/chromeos_version.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return entry; | 345 return entry; |
346 if (entry->hasSameRules(timezone)) | 346 if (entry->hasSameRules(timezone)) |
347 known_timezone = entry; | 347 known_timezone = entry; |
348 } | 348 } |
349 | 349 |
350 // May return NULL if we did not find a matching timezone in our list. | 350 // May return NULL if we did not find a matching timezone in our list. |
351 return known_timezone; | 351 return known_timezone; |
352 } | 352 } |
353 | 353 |
354 void TimezoneSettingsBaseImpl::NotifyRenderers() { | 354 void TimezoneSettingsBaseImpl::NotifyRenderers() { |
355 content::RenderProcessHost::iterator process_iterator( | 355 content::RenderWidgetHost::List widgets = |
356 content::RenderProcessHost::AllHostsIterator()); | 356 content::RenderWidgetHost::GetRenderWidgetHosts(); |
357 for (; !process_iterator.IsAtEnd(); process_iterator.Advance()) { | 357 for (size_t i = 0; i < widgets.size(); ++i) { |
358 content::RenderProcessHost* render_process_host = | 358 if (widgets[i]->IsRenderView()) { |
359 process_iterator.GetCurrentValue(); | 359 content::RenderViewHost* view = content::RenderViewHost::From(widgets[i]); |
360 content::RenderProcessHost::RenderWidgetHostsIterator widget_iterator( | 360 view->NotifyTimezoneChange(); |
361 render_process_host->GetRenderWidgetHostsIterator()); | |
362 for (; !widget_iterator.IsAtEnd(); widget_iterator.Advance()) { | |
363 const content::RenderWidgetHost* widget = | |
364 widget_iterator.GetCurrentValue(); | |
365 if (widget->IsRenderView()) { | |
366 content::RenderViewHost* view = content::RenderViewHost::From( | |
367 const_cast<content::RenderWidgetHost*>(widget)); | |
368 view->NotifyTimezoneChange(); | |
369 } | |
370 } | 361 } |
371 } | 362 } |
372 } | 363 } |
373 | 364 |
374 void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) { | 365 void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) { |
375 // Replace |timezone| by a known timezone with the same rules. If none exists | 366 // Replace |timezone| by a known timezone with the same rules. If none exists |
376 // go on with |timezone|. | 367 // go on with |timezone|. |
377 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone); | 368 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone); |
378 if (!known_timezone) | 369 if (!known_timezone) |
379 known_timezone = &timezone; | 370 known_timezone = &timezone; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 450 |
460 // static | 451 // static |
461 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { | 452 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { |
462 icu::UnicodeString id; | 453 icu::UnicodeString id; |
463 timezone.getID(id); | 454 timezone.getID(id); |
464 return string16(id.getBuffer(), id.length()); | 455 return string16(id.getBuffer(), id.length()); |
465 } | 456 } |
466 | 457 |
467 } // namespace system | 458 } // namespace system |
468 } // namespace chromeos | 459 } // namespace chromeos |
OLD | NEW |