Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / content / browser / time_zone_monitor_win.cc
blobabeaafff81cadc84ceb4f7547b09a59c4b724d91
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.
5 #include "content/browser/time_zone_monitor.h"
7 #include <windows.h>
9 #include "base/basictypes.h"
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/gfx/win/singleton_hwnd_observer.h"
15 namespace content {
17 class TimeZoneMonitorWin : public TimeZoneMonitor {
18 public:
19 TimeZoneMonitorWin()
20 : TimeZoneMonitor(),
21 singleton_hwnd_observer_(
22 new gfx::SingletonHwndObserver(base::Bind(
23 &TimeZoneMonitorWin::OnWndProc, base::Unretained(this)))) {}
25 ~TimeZoneMonitorWin() override {}
27 private:
28 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
29 if (message != WM_TIMECHANGE) {
30 return;
33 NotifyRenderers();
36 scoped_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
38 DISALLOW_COPY_AND_ASSIGN(TimeZoneMonitorWin);
41 // static
42 scoped_ptr<TimeZoneMonitor> TimeZoneMonitor::Create() {
43 return scoped_ptr<TimeZoneMonitor>(new TimeZoneMonitorWin());
46 } // namespace content