Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: ui/base/win/singleton_hwnd.h

Issue 9359019: Split the singleton hwnd from screen_compatible_dc_win.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/win/singleton_hwnd.cc » ('j') | ui/base/win/singleton_hwnd.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/singleton_hwnd.h
===================================================================
--- ui/base/win/singleton_hwnd.h (revision 0)
+++ ui/base/win/singleton_hwnd.h (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_WIN_SINGLETON_HWND_H_
+#define UI_BASE_WIN_SINGLETON_HWND_H_
+#pragma once
+
+#include <windows.h>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/callback_forward.h"
+#include "base/memory/singleton.h"
+
+namespace ui {
+
+typedef base::Callback<void(HWND, UINT, WPARAM, LPARAM)> WndProcCallback;
+
+// Singleton HWND that allows interested clients to receive WM_* notifications.
+class SingletonHwnd {
+ public:
+ // Singleton getter.
+ static SingletonHwnd* GetInstance();
+
+ // Registers a listener callback for WM_* notifications.
+ void RegisterListener(WndProcCallback& callback);
+
+ // Windows callback for WM_* notifications.
+ void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+
+ private:
+ SingletonHwnd();
+ ~SingletonHwnd();
+
+ // Listener HWND for WM_* notifications.
+ HWND listener_window_;
+
+ // List of registered listener callbacks.
+ std::vector<WndProcCallback> listeners_;
+
+ friend struct DefaultSingletonTraits<SingletonHwnd>;
+
+ DISALLOW_COPY_AND_ASSIGN(SingletonHwnd);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_WIN_SINGLETON_HWND_H_
« no previous file with comments | « no previous file | ui/base/win/singleton_hwnd.cc » ('j') | ui/base/win/singleton_hwnd.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698