| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/focus/focus_manager.h" | 5 #include "views/focus/focus_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 "Attempting to remove an unregistered WidgetFocusChangeListener."; | 47 "Attempting to remove an unregistered WidgetFocusChangeListener."; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void FocusManager::WidgetFocusManager::OnWidgetFocusEvent( | 51 void FocusManager::WidgetFocusManager::OnWidgetFocusEvent( |
| 52 gfx::NativeView focused_before, | 52 gfx::NativeView focused_before, |
| 53 gfx::NativeView focused_now) { | 53 gfx::NativeView focused_now) { |
| 54 if (!enabled_) | 54 if (!enabled_) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 // Perform a safe iteration over the focus listeners, as the array of | 57 // Perform a safe iteration over the focus listeners, as the array |
| 58 // may change during notification. | 58 // may change during notification. |
| 59 WidgetFocusChangeListenerList local_listeners(focus_change_listeners_); | 59 WidgetFocusChangeListenerList local_listeners(focus_change_listeners_); |
| 60 WidgetFocusChangeListenerList::iterator iter(local_listeners.begin()); | 60 WidgetFocusChangeListenerList::iterator iter(local_listeners.begin()); |
| 61 for (;iter != local_listeners.end(); ++iter) { | 61 for (;iter != local_listeners.end(); ++iter) { |
| 62 (*iter)->NativeFocusWillChange(focused_before, focused_now); | 62 (*iter)->NativeFocusWillChange(focused_before, focused_now); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 FocusManager::WidgetFocusManager* | 67 FocusManager::WidgetFocusManager* |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), | 529 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), |
| 530 listener); | 530 listener); |
| 531 if (place == focus_change_listeners_.end()) { | 531 if (place == focus_change_listeners_.end()) { |
| 532 NOTREACHED() << "Removing a listener that isn't registered."; | 532 NOTREACHED() << "Removing a listener that isn't registered."; |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 focus_change_listeners_.erase(place); | 535 focus_change_listeners_.erase(place); |
| 536 } | 536 } |
| 537 | 537 |
| 538 } // namespace views | 538 } // namespace views |
| OLD | NEW |