Index: ui/views/widget/hwnd_subclass.h |
=================================================================== |
--- ui/views/widget/hwnd_subclass.h (revision 0) |
+++ ui/views/widget/hwnd_subclass.h (revision 0) |
@@ -0,0 +1,54 @@ |
+// 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_VIEWS_WIDGET_HWND_SUBCLASS_H_ |
+#define UI_VIEWS_WIDGET_HWND_SUBCLASS_H_ |
+#pragma once |
+ |
+#include <windows.h> |
+ |
+#include "base/gtest_prod_util.h" |
+#include "ui/base/view_prop.h" |
+#include "ui/gfx/native_widget_types.h" |
+#include "ui/views/views_export.h" |
+ |
+namespace views { |
+ |
+// An object that instance-subclasses a window. If the window has already been |
+// instance-subclassed, that subclassing is lost. |
+class VIEWS_EXPORT HWNDSubclass { |
+ public: |
+ explicit HWNDSubclass(HWND target); |
+ ~HWNDSubclass(); |
+ |
+ LRESULT OnWndProc(HWND hwnd, UINT message, WPARAM w_param, LPARAM l_param); |
+ |
+ protected: |
+ // A derived class overrides this method to perform filtering of the messages |
+ // before the |original_wnd_proc_| sees them. Return true to consume the |
+ // message and prevent |original_wnd_proc_| from seeing them at all, false to |
+ // allow it to process them. |
+ virtual bool FilterMessage(HWND hwnd, |
+ UINT message, |
+ WPARAM w_param, |
+ LPARAM l_param, |
+ LRESULT* l_result); |
+ |
+ private: |
+ FRIEND_TEST_ALL_PREFIXES(HWNDSubclassTest, Installation); |
+ FRIEND_TEST_ALL_PREFIXES(HWNDSubclassTest, Filtering); |
+ |
+ static WNDPROC GetClassWndProc(HWND target); |
+ static WNDPROC GetCurrentWndProc(HWND target); |
+ |
+ HWND target_; |
+ WNDPROC original_wnd_proc_; |
+ ui::ViewProp prop_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HWNDSubclass); |
+}; |
+ |
+} // namespace views |
+ |
+#endif // UI_VIEWS_WIDGET_HWND_SUBCLASS_H_ |
Property changes on: ui\views\widget\hwnd_subclass.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |