1 // Copyright (c) 2012 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 #ifndef UI_GFX_WIN_SINGLETON_HWND_H_
6 #define UI_GFX_WIN_SINGLETON_HWND_H_
11 #include "base/basictypes.h"
12 #include "base/callback_forward.h"
13 #include "base/observer_list.h"
14 #include "ui/gfx/win/window_impl.h"
16 template<typename T
> struct DefaultSingletonTraits
;
20 // Singleton message-only HWND that allows interested clients to receive WM_*
22 class GFX_EXPORT SingletonHwnd
: public WindowImpl
{
24 static SingletonHwnd
* GetInstance();
26 // Observer interface for receiving Windows WM_* notifications.
29 virtual void OnWndProc(HWND hwnd
,
35 // Add/remove observer to receive WM_* notifications.
36 void AddObserver(Observer
* observer
);
37 void RemoveObserver(Observer
* observer
);
39 // Windows callback for WM_* notifications.
40 BOOL
ProcessWindowMessage(HWND window
,
45 DWORD msg_map_id
) override
;
48 friend struct DefaultSingletonTraits
<SingletonHwnd
>;
51 ~SingletonHwnd() override
;
53 // List of registered observers.
54 ObserverList
<Observer
> observer_list_
;
56 DISALLOW_COPY_AND_ASSIGN(SingletonHwnd
);
61 #endif // UI_GFX_WIN_SINGLETON_HWND_H_