| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void FocusManager::InstallFocusSubclass(HWND window, View* view) { | 223 void FocusManager::InstallFocusSubclass(HWND window, View* view) { |
| 224 DCHECK(window); | 224 DCHECK(window); |
| 225 | 225 |
| 226 bool already_subclassed = | 226 bool already_subclassed = |
| 227 reinterpret_cast<bool>(GetProp(window, | 227 reinterpret_cast<bool>(GetProp(window, |
| 228 kFocusSubclassInstalled)); | 228 kFocusSubclassInstalled)); |
| 229 if (already_subclassed && | 229 if (already_subclassed && |
| 230 !win_util::IsSubclassed(window, &FocusWindowCallback)) { | 230 !win_util::IsSubclassed(window, &FocusWindowCallback)) { |
| 231 NOTREACHED() << "window sub-classed by someone other than the FocusManager"; | 231 NOTREACHED() << "window sub-classed by someone other than the FocusManager"; |
| 232 // Track in UMA so we know if this case happens. | 232 // Track in UMA so we know if this case happens. |
| 233 UMA_HISTOGRAM_COUNTS(L"FocusManager.MultipleSubclass", 1); | 233 UMA_HISTOGRAM_COUNTS("FocusManager.MultipleSubclass", 1); |
| 234 } else { | 234 } else { |
| 235 win_util::Subclass(window, &FocusWindowCallback); | 235 win_util::Subclass(window, &FocusWindowCallback); |
| 236 SetProp(window, kFocusSubclassInstalled, reinterpret_cast<HANDLE>(true)); | 236 SetProp(window, kFocusSubclassInstalled, reinterpret_cast<HANDLE>(true)); |
| 237 } | 237 } |
| 238 if (view) | 238 if (view) |
| 239 SetProp(window, kViewKey, view); | 239 SetProp(window, kViewKey, view); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void FocusManager::UninstallFocusSubclass(HWND window) { | 242 void FocusManager::UninstallFocusSubclass(HWND window) { |
| 243 DCHECK(window); | 243 DCHECK(window); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), | 835 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), |
| 836 listener); | 836 listener); |
| 837 if (place == focus_change_listeners_.end()) { | 837 if (place == focus_change_listeners_.end()) { |
| 838 NOTREACHED() << "Removing a listener that isn't registered."; | 838 NOTREACHED() << "Removing a listener that isn't registered."; |
| 839 return; | 839 return; |
| 840 } | 840 } |
| 841 focus_change_listeners_.erase(place); | 841 focus_change_listeners_.erase(place); |
| 842 } | 842 } |
| 843 | 843 |
| 844 } // namespace views | 844 } // namespace views |
| 845 | |
| OLD | NEW |