OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/time_zone_monitor.h" |
| 6 |
| 7 #include <windows.h> |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" |
| 11 #include "ui/gfx/win/singleton_hwnd.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class TimeZoneMonitorWin : public TimeZoneMonitor, |
| 16 public gfx::SingletonHwnd::Observer { |
| 17 public: |
| 18 TimeZoneMonitorWin() : TimeZoneMonitor() { |
| 19 gfx::SingletonHwnd::GetInstance()->AddObserver(this); |
| 20 } |
| 21 |
| 22 virtual ~TimeZoneMonitorWin() { |
| 23 gfx::SingletonHwnd::GetInstance()->RemoveObserver(this); |
| 24 } |
| 25 |
| 26 // gfx::SingletonHwnd::Observer implementation. |
| 27 virtual void OnWndProc(HWND hwnd, |
| 28 UINT message, |
| 29 WPARAM wparam, |
| 30 LPARAM lparam) OVERRIDE { |
| 31 DCHECK_EQ(hwnd, gfx::SingletonHwnd::GetInstance()->hwnd()); |
| 32 if (message != WM_TIMECHANGE) { |
| 33 return; |
| 34 } |
| 35 |
| 36 NotifyRenderers(); |
| 37 } |
| 38 |
| 39 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(TimeZoneMonitorWin); |
| 41 }; |
| 42 |
| 43 // static |
| 44 TimeZoneMonitor* TimeZoneMonitor::Create() { |
| 45 return new TimeZoneMonitorWin(); |
| 46 } |
| 47 |
| 48 } // namespace content |
OLD | NEW |