Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / ui / gfx / win / singleton_hwnd.h
blobfe2e2986324c7ed897b851ae8786a4071f04af75
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_
8 #include <windows.h>
9 #include <vector>
11 #include "base/observer_list.h"
12 #include "ui/gfx/gfx_export.h"
13 #include "ui/gfx/win/window_impl.h"
15 namespace base {
16 template<typename T> struct DefaultSingletonTraits;
19 namespace gfx {
21 class SingletonHwndObserver;
23 // Singleton message-only HWND that allows interested clients to receive WM_*
24 // notifications.
25 class GFX_EXPORT SingletonHwnd : public WindowImpl {
26 public:
27 static SingletonHwnd* GetInstance();
29 // Windows callback for WM_* notifications.
30 BOOL ProcessWindowMessage(HWND window,
31 UINT message,
32 WPARAM wparam,
33 LPARAM lparam,
34 LRESULT& result,
35 DWORD msg_map_id) override;
37 private:
38 friend class SingletonHwndObserver;
39 friend struct base::DefaultSingletonTraits<SingletonHwnd>;
41 SingletonHwnd();
42 ~SingletonHwnd() override;
44 // Add/remove SingletonHwndObserver to forward WM_* notifications.
45 void AddObserver(SingletonHwndObserver* observer);
46 void RemoveObserver(SingletonHwndObserver* observer);
48 // List of registered observers.
49 base::ObserverList<SingletonHwndObserver, true> observer_list_;
51 DISALLOW_COPY_AND_ASSIGN(SingletonHwnd);
54 } // namespace gfx
56 #endif // UI_GFX_WIN_SINGLETON_HWND_H_