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 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_ |
6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void OnWidgetFocusEvent(gfx::NativeView focused_before, | 143 void OnWidgetFocusEvent(gfx::NativeView focused_before, |
144 gfx::NativeView focused_now); | 144 gfx::NativeView focused_now); |
145 | 145 |
146 // Enable/Disable notification of registered listeners during calls | 146 // Enable/Disable notification of registered listeners during calls |
147 // to OnWidgetFocusEvent. Used to prevent unwanted focus changes from | 147 // to OnWidgetFocusEvent. Used to prevent unwanted focus changes from |
148 // propagating notifications. | 148 // propagating notifications. |
149 void EnableNotifications() { enabled_ = true; } | 149 void EnableNotifications() { enabled_ = true; } |
150 void DisableNotifications() { enabled_ = false; } | 150 void DisableNotifications() { enabled_ = false; } |
151 | 151 |
152 private: | 152 private: |
153 WidgetFocusManager() : enabled_(true) {} | 153 WidgetFocusManager(); |
| 154 ~WidgetFocusManager(); |
154 | 155 |
155 typedef std::vector<WidgetFocusChangeListener*> | 156 typedef std::vector<WidgetFocusChangeListener*> |
156 WidgetFocusChangeListenerList; | 157 WidgetFocusChangeListenerList; |
157 WidgetFocusChangeListenerList focus_change_listeners_; | 158 WidgetFocusChangeListenerList focus_change_listeners_; |
158 | 159 |
159 bool enabled_; | 160 bool enabled_; |
160 | 161 |
161 friend struct DefaultSingletonTraits<WidgetFocusManager>; | 162 friend struct DefaultSingletonTraits<WidgetFocusManager>; |
162 DISALLOW_COPY_AND_ASSIGN(WidgetFocusManager); | 163 DISALLOW_COPY_AND_ASSIGN(WidgetFocusManager); |
163 }; | 164 }; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 ~AutoNativeNotificationDisabler() { | 337 ~AutoNativeNotificationDisabler() { |
337 FocusManager::GetWidgetFocusManager()->EnableNotifications(); | 338 FocusManager::GetWidgetFocusManager()->EnableNotifications(); |
338 } | 339 } |
339 private: | 340 private: |
340 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); | 341 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); |
341 }; | 342 }; |
342 | 343 |
343 } // namespace views | 344 } // namespace views |
344 | 345 |
345 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ | 346 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |