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

Side by Side Diff: chrome/browser/chromeos/system/timezone_settings.cc

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cleanup crashes. Created 7 years, 6 months 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
OLDNEW
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
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 scoped_ptr<content::RenderWidgetHost::List> hosts =
356 content::RenderProcessHost::AllHostsIterator()); 356 content::RenderWidgetHost::GetRenderWidgetHosts();
357 for (; !process_iterator.IsAtEnd(); process_iterator.Advance()) { 357 for (content::RenderWidgetHost::List::const_iterator it = hosts->begin();
358 content::RenderProcessHost* render_process_host = 358 it != hosts->end();
359 process_iterator.GetCurrentValue(); 359 ++it) {
360 content::RenderProcessHost::RenderWidgetHostsIterator widget_iterator( 360 const content::RenderWidgetHost* widget = *it;
361 render_process_host->GetRenderWidgetHostsIterator()); 361 if (widget->IsRenderView()) {
362 for (; !widget_iterator.IsAtEnd(); widget_iterator.Advance()) { 362 content::RenderViewHost* view = content::RenderViewHost::From(
363 const content::RenderWidgetHost* widget = 363 const_cast<content::RenderWidgetHost*>(widget));
364 widget_iterator.GetCurrentValue(); 364 view->NotifyTimezoneChange();
365 if (widget->IsRenderView()) {
366 content::RenderViewHost* view = content::RenderViewHost::From(
367 const_cast<content::RenderWidgetHost*>(widget));
368 view->NotifyTimezoneChange();
369 }
370 } 365 }
371 } 366 }
372 } 367 }
373 368
374 void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) { 369 void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) {
375 // Replace |timezone| by a known timezone with the same rules. If none exists 370 // Replace |timezone| by a known timezone with the same rules. If none exists
376 // go on with |timezone|. 371 // go on with |timezone|.
377 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone); 372 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone);
378 if (!known_timezone) 373 if (!known_timezone)
379 known_timezone = &timezone; 374 known_timezone = &timezone;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 454
460 // static 455 // static
461 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { 456 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) {
462 icu::UnicodeString id; 457 icu::UnicodeString id;
463 timezone.getID(id); 458 timezone.getID(id);
464 return string16(id.getBuffer(), id.length()); 459 return string16(id.getBuffer(), id.length());
465 } 460 }
466 461
467 } // namespace system 462 } // namespace system
468 } // namespace chromeos 463 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698