Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: ui/views/focus/widget_focus_manager.h

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/focus/view_storage.cc ('k') | ui/views/focus/widget_focus_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_WIDGET_FOCUS_MANAGER_H_ 5 #ifndef UI_VIEWS_FOCUS_WIDGET_FOCUS_MANAGER_H_
6 #define UI_VIEWS_FOCUS_WIDGET_FOCUS_MANAGER_H_ 6 #define UI_VIEWS_FOCUS_WIDGET_FOCUS_MANAGER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views/views_export.h" 11 #include "ui/views/views_export.h"
12 12
13 namespace base {
13 template <typename T> struct DefaultSingletonTraits; 14 template <typename T> struct DefaultSingletonTraits;
15 }
14 16
15 namespace views { 17 namespace views {
16 18
17 // This interface should be implemented by classes that want to be notified when 19 // This interface should be implemented by classes that want to be notified when
18 // the native focus is about to change. Listeners implementing this interface 20 // the native focus is about to change. Listeners implementing this interface
19 // will be invoked for all native focus changes across the entire Chrome 21 // will be invoked for all native focus changes across the entire Chrome
20 // application. FocusChangeListeners are only called for changes within the 22 // application. FocusChangeListeners are only called for changes within the
21 // children of a single top-level native-view. 23 // children of a single top-level native-view.
22 class WidgetFocusChangeListener { 24 class WidgetFocusChangeListener {
23 public: 25 public:
(...skipping 17 matching lines...) Expand all
41 // null when focus is lost. 43 // null when focus is lost.
42 void OnNativeFocusChanged(gfx::NativeView focused_now); 44 void OnNativeFocusChanged(gfx::NativeView focused_now);
43 45
44 // Enable/Disable notification of registered listeners during calls 46 // Enable/Disable notification of registered listeners during calls
45 // to OnNativeFocusChanged. Used to prevent unwanted focus changes from 47 // to OnNativeFocusChanged. Used to prevent unwanted focus changes from
46 // propagating notifications. 48 // propagating notifications.
47 void EnableNotifications() { enabled_ = true; } 49 void EnableNotifications() { enabled_ = true; }
48 void DisableNotifications() { enabled_ = false; } 50 void DisableNotifications() { enabled_ = false; }
49 51
50 private: 52 private:
51 friend struct DefaultSingletonTraits<WidgetFocusManager>; 53 friend struct base::DefaultSingletonTraits<WidgetFocusManager>;
52 54
53 WidgetFocusManager(); 55 WidgetFocusManager();
54 ~WidgetFocusManager(); 56 ~WidgetFocusManager();
55 57
56 base::ObserverList<WidgetFocusChangeListener> focus_change_listeners_; 58 base::ObserverList<WidgetFocusChangeListener> focus_change_listeners_;
57 59
58 bool enabled_; 60 bool enabled_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(WidgetFocusManager); 62 DISALLOW_COPY_AND_ASSIGN(WidgetFocusManager);
61 }; 63 };
62 64
63 // A basic helper class that is used to disable native focus change 65 // A basic helper class that is used to disable native focus change
64 // notifications within a scope. 66 // notifications within a scope.
65 class VIEWS_EXPORT AutoNativeNotificationDisabler { 67 class VIEWS_EXPORT AutoNativeNotificationDisabler {
66 public: 68 public:
67 AutoNativeNotificationDisabler(); 69 AutoNativeNotificationDisabler();
68 ~AutoNativeNotificationDisabler(); 70 ~AutoNativeNotificationDisabler();
69 71
70 private: 72 private:
71 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); 73 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler);
72 }; 74 };
73 75
74 } // namespace views 76 } // namespace views
75 77
76 #endif // UI_VIEWS_FOCUS_WIDGET_FOCUS_MANAGER_H_ 78 #endif // UI_VIEWS_FOCUS_WIDGET_FOCUS_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/views/focus/view_storage.cc ('k') | ui/views/focus/widget_focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698