1 // Copyright 2015 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 "ui/gfx/win/singleton_hwnd_observer.h"
7 #include "ui/gfx/win/singleton_hwnd.h"
11 SingletonHwndObserver::SingletonHwndObserver(const WndProc
& wnd_proc
)
12 : wnd_proc_(wnd_proc
) {
13 DCHECK(!wnd_proc
.is_null());
14 SingletonHwnd::GetInstance()->AddObserver(this);
17 SingletonHwndObserver::~SingletonHwndObserver() {
21 void SingletonHwndObserver::ClearWndProc() {
22 if (!wnd_proc_
.is_null()) {
23 SingletonHwnd::GetInstance()->RemoveObserver(this);
28 void SingletonHwndObserver::OnWndProc(HWND hwnd
,
32 wnd_proc_
.Run(hwnd
, message
, wparam
, lparam
);