| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define UI_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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 ~AutoNativeNotificationDisabler() { | 302 ~AutoNativeNotificationDisabler() { |
| 302 FocusManager::GetWidgetFocusManager()->EnableNotifications(); | 303 FocusManager::GetWidgetFocusManager()->EnableNotifications(); |
| 303 } | 304 } |
| 304 private: | 305 private: |
| 305 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); | 306 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); |
| 306 }; | 307 }; |
| 307 | 308 |
| 308 } // namespace ui | 309 } // namespace ui |
| 309 | 310 |
| 310 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 311 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| OLD | NEW |