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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 // Perform a safe iteration over the focus listeners, as the array | 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 FocusManager::WidgetFocusManager::WidgetFocusManager() : enabled_(true) {} |
| 67 |
| 68 FocusManager::WidgetFocusManager::~WidgetFocusManager() {} |
| 69 |
66 // static | 70 // static |
67 FocusManager::WidgetFocusManager* | 71 FocusManager::WidgetFocusManager* |
68 FocusManager::WidgetFocusManager::GetInstance() { | 72 FocusManager::WidgetFocusManager::GetInstance() { |
69 return Singleton<WidgetFocusManager>::get(); | 73 return Singleton<WidgetFocusManager>::get(); |
70 } | 74 } |
71 | 75 |
72 // FocusManager ----------------------------------------------------- | 76 // FocusManager ----------------------------------------------------- |
73 | 77 |
74 FocusManager::FocusManager(Widget* widget) | 78 FocusManager::FocusManager(Widget* widget) |
75 : widget_(widget), | 79 : widget_(widget), |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), | 499 std::find(focus_change_listeners_.begin(), focus_change_listeners_.end(), |
496 listener); | 500 listener); |
497 if (place == focus_change_listeners_.end()) { | 501 if (place == focus_change_listeners_.end()) { |
498 NOTREACHED() << "Removing a listener that isn't registered."; | 502 NOTREACHED() << "Removing a listener that isn't registered."; |
499 return; | 503 return; |
500 } | 504 } |
501 focus_change_listeners_.erase(place); | 505 focus_change_listeners_.erase(place); |
502 } | 506 } |
503 | 507 |
504 } // namespace views | 508 } // namespace views |
OLD | NEW |