OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/win/hwnd_subclass.h" | 5 #include "ui/base/win/hwnd_subclass.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "ui/base/win/hwnd_util.h" | 12 #include "ui/gfx/win/dpi.h" |
13 #include "ui/gfx/dpi_win.h" | 13 #include "ui/gfx/win/hwnd_util.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 const char kHWNDSubclassKey[] = "__UI_BASE_WIN_HWND_SUBCLASS_PROC__"; | 16 const char kHWNDSubclassKey[] = "__UI_BASE_WIN_HWND_SUBCLASS_PROC__"; |
17 | 17 |
18 LRESULT CALLBACK WndProc(HWND hwnd, | 18 LRESULT CALLBACK WndProc(HWND hwnd, |
19 UINT message, | 19 UINT message, |
20 WPARAM w_param, | 20 WPARAM w_param, |
21 LPARAM l_param) { | 21 LPARAM l_param) { |
22 ui::HWNDSubclass* wrapped_wnd_proc = | 22 ui::HWNDSubclass* wrapped_wnd_proc = |
23 reinterpret_cast<ui::HWNDSubclass*>( | 23 reinterpret_cast<ui::HWNDSubclass*>( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 std::vector<HWNDMessageFilter*>::iterator it = | 116 std::vector<HWNDMessageFilter*>::iterator it = |
117 std::find(filters_.begin(), filters_.end(), filter); | 117 std::find(filters_.begin(), filters_.end(), filter); |
118 if (it != filters_.end()) | 118 if (it != filters_.end()) |
119 filters_.erase(it); | 119 filters_.erase(it); |
120 } | 120 } |
121 | 121 |
122 HWNDSubclass::HWNDSubclass(HWND target) | 122 HWNDSubclass::HWNDSubclass(HWND target) |
123 : target_(target), | 123 : target_(target), |
124 original_wnd_proc_(GetCurrentWndProc(target)), | 124 original_wnd_proc_(GetCurrentWndProc(target)), |
125 prop_(target, kHWNDSubclassKey, this) { | 125 prop_(target, kHWNDSubclassKey, this) { |
126 ui::SetWindowProc(target_, &WndProc); | 126 gfx::SetWindowProc(target_, &WndProc); |
127 } | 127 } |
128 | 128 |
129 HWNDSubclass::~HWNDSubclass() { | 129 HWNDSubclass::~HWNDSubclass() { |
130 } | 130 } |
131 | 131 |
132 LRESULT HWNDSubclass::OnWndProc(HWND hwnd, | 132 LRESULT HWNDSubclass::OnWndProc(HWND hwnd, |
133 UINT message, | 133 UINT message, |
134 WPARAM w_param, | 134 WPARAM w_param, |
135 LPARAM l_param) { | 135 LPARAM l_param) { |
136 | 136 |
(...skipping 27 matching lines...) Expand all Loading... |
164 // In most cases, |original_wnd_proc_| will take care of calling | 164 // In most cases, |original_wnd_proc_| will take care of calling |
165 // DefWindowProc. | 165 // DefWindowProc. |
166 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param); | 166 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param); |
167 } | 167 } |
168 | 168 |
169 HWNDMessageFilter::~HWNDMessageFilter() { | 169 HWNDMessageFilter::~HWNDMessageFilter() { |
170 HWNDSubclass::RemoveFilterFromAllTargets(this); | 170 HWNDSubclass::RemoveFilterFromAllTargets(this); |
171 } | 171 } |
172 | 172 |
173 } // namespace ui | 173 } // namespace ui |
OLD | NEW |