| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 (*it)->RemoveFilter(filter); | 103 (*it)->RemoveFilter(filter); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 HWNDSubclass* HWNDSubclass::GetHwndSubclassForTarget(HWND target) { | 107 HWNDSubclass* HWNDSubclass::GetHwndSubclassForTarget(HWND target) { |
| 108 return HWNDSubclassFactory::GetInstance()->GetHwndSubclassForTarget(target); | 108 return HWNDSubclassFactory::GetInstance()->GetHwndSubclassForTarget(target); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void HWNDSubclass::AddFilter(HWNDMessageFilter* filter) { | 111 void HWNDSubclass::AddFilter(HWNDMessageFilter* filter) { |
| 112 DCHECK(filter); | 112 DCHECK(filter); |
| 113 if (!ContainsValue(filters_, filter)) | 113 if (!base::ContainsValue(filters_, filter)) |
| 114 filters_.push_back(filter); | 114 filters_.push_back(filter); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void HWNDSubclass::RemoveFilter(HWNDMessageFilter* filter) { | 117 void HWNDSubclass::RemoveFilter(HWNDMessageFilter* filter) { |
| 118 std::vector<HWNDMessageFilter*>::iterator it = | 118 std::vector<HWNDMessageFilter*>::iterator it = |
| 119 std::find(filters_.begin(), filters_.end(), filter); | 119 std::find(filters_.begin(), filters_.end(), filter); |
| 120 if (it != filters_.end()) | 120 if (it != filters_.end()) |
| 121 filters_.erase(it); | 121 filters_.erase(it); |
| 122 } | 122 } |
| 123 | 123 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // In most cases, |original_wnd_proc_| will take care of calling | 163 // In most cases, |original_wnd_proc_| will take care of calling |
| 164 // DefWindowProc. | 164 // DefWindowProc. |
| 165 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param); | 165 return CallWindowProc(original_wnd_proc_, hwnd, message, w_param, l_param); |
| 166 } | 166 } |
| 167 | 167 |
| 168 HWNDMessageFilter::~HWNDMessageFilter() { | 168 HWNDMessageFilter::~HWNDMessageFilter() { |
| 169 HWNDSubclass::RemoveFilterFromAllTargets(this); | 169 HWNDSubclass::RemoveFilterFromAllTargets(this); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace ui | 172 } // namespace ui |
| OLD | NEW |