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

Unified Diff: content/browser/time_zone_monitor.cc

Issue 2304073003: Mojoify time zone update IPC from browser to renderer (Closed)
Patch Set: Rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/time_zone_monitor.h ('k') | content/browser/time_zone_monitor_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/time_zone_monitor.cc
diff --git a/content/browser/time_zone_monitor.cc b/content/browser/time_zone_monitor.cc
index a9a5a9b6c53689695468bb91294d934281e89c67..858a0e4d8d8e80ff0188b9a1fe4ed8bddda13dc3 100644
--- a/content/browser/time_zone_monitor.cc
+++ b/content/browser/time_zone_monitor.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_process_host.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
@@ -21,7 +20,11 @@ TimeZoneMonitor::~TimeZoneMonitor() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
-void TimeZoneMonitor::NotifyRenderers() {
+void TimeZoneMonitor::Bind(device::mojom::TimeZoneMonitorRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
+void TimeZoneMonitor::NotifyClients() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if defined(OS_CHROMEOS)
// On CrOS, ICU's default tz is already set to a new zone. No
@@ -45,12 +48,16 @@ void TimeZoneMonitor::NotifyRenderers() {
std::string zone_id_str;
new_zone->getID(zone_id).toUTF8String(zone_id_str);
VLOG(1) << "timezone reset to " << zone_id_str;
- for (RenderProcessHost::iterator iterator =
- RenderProcessHost::AllHostsIterator();
- !iterator.IsAtEnd();
- iterator.Advance()) {
- iterator.GetCurrentValue()->NotifyTimezoneChange(zone_id_str);
- }
+
+ clients_.ForAllPtrs(
+ [&zone_id_str](device::mojom::TimeZoneMonitorClient* client) {
+ client->OnTimeZoneChange(zone_id_str);
+ });
+}
+
+void TimeZoneMonitor::AddClient(
+ device::mojom::TimeZoneMonitorClientPtr client) {
+ clients_.AddPtr(std::move(client));
}
} // namespace content
« no previous file with comments | « content/browser/time_zone_monitor.h ('k') | content/browser/time_zone_monitor_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698