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

Unified Diff: content/browser/time_zone_monitor.h

Issue 251613002: Broadcast NotifyTimezoneChange to all RenderProcessHosts when the system time zone changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
Index: content/browser/time_zone_monitor.h
diff --git a/content/browser/time_zone_monitor.h b/content/browser/time_zone_monitor.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7291be0f67256500963d06276fc4d1e07ffa516
--- /dev/null
+++ b/content/browser/time_zone_monitor.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_TIME_ZONE_MONITOR_H_
+#define CONTENT_BROWSER_TIME_ZONE_MONITOR_H_
+
+#include "base/basictypes.h"
+
+namespace content {
+
+// TimeZoneMonitor watches the system time zone, and notifies renderers
+// when it changes. Some renderer code caches the system time zone, so
+// this notification is necessary to inform such code that cached
+// timezone data may have become invalid. Due to sandboxing, it is not
+// possible for renderer processes to monitor for system time zone
+// changes themselves, so this must happen in the browser process.
+//
+// Sandboxing also may prevent renderer processes from reading the time
+// zone when it does change, so platforms may have to deal with this in
+// platform-specific ways:
+// - Mac uses a sandbox hole defined in content/renderer/renderer.sb.
+// - Linux-based platforms use ProxyLocaltimeCallToBrowser in
+// content/zygote/zygote_main_linux.cc and HandleLocaltime in
+// content/browser/renderer_host/sandbox_ipc_linux.cc to override
+// localtime in renderer processes with custom code that calls
+// localtime in the browser process via Chrome IPC.
+
+class TimeZoneMonitor {
+ public:
+ // Returns a new TimeZoneMonitor object (likely a subclass) specific to the
+ // platform.
+ static TimeZoneMonitor* Create();
Robert Sesek 2014/04/28 20:53:39 I think the preference now is to return a scoped_p
+
+ TimeZoneMonitor();
Robert Sesek 2014/04/28 20:53:39 Should the ctor be public if you have a Create met
Mark Mentovai 2014/04/28 21:08:38 rsesek wrote:
Robert Sesek 2014/04/28 21:14:48 Right, but is it meaningful to actually construct
+ virtual ~TimeZoneMonitor();
+
+ protected:
+ // Loop over all renderers and notify them that the system time zone may
+ // have changed.
+ void NotifyRenderers();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TimeZoneMonitor);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_TIME_ZONE_MONITOR_H_

Powered by Google App Engine
This is Rietveld 408576698