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

Side by Side Diff: chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H _
6 #define CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H _ 6 #define CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H _
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "ui/events/platform/platform_event_observer.h" 10 #include "ui/events/platform/platform_event_observer.h"
11 11
12 typedef union _XEvent XEvent; 12 typedef union _XEvent XEvent;
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 // XInputHierarchyChangedEventListener listens for an XI_HierarchyChanged event, 16 // XInputHierarchyChangedEventListener listens for an XI_HierarchyChanged event,
17 // which is sent to Chrome when X detects a system or USB keyboard (or mouse), 17 // which is sent to Chrome when X detects a system or USB keyboard (or mouse),
18 // then tells X to change the current XKB keyboard layout. Start by just calling 18 // then tells X to change the current XKB keyboard layout. Start by just calling
19 // instance() to get it going. 19 // instance() to get it going.
20 class XInputHierarchyChangedEventListener : public ui::PlatformEventObserver { 20 class XInputHierarchyChangedEventListener : public ui::PlatformEventObserver {
21 public: 21 public:
22 static XInputHierarchyChangedEventListener* GetInstance(); 22 static XInputHierarchyChangedEventListener* GetInstance();
23 23
24 void Stop(); 24 void Stop();
25 25
26 private: 26 private:
27 // Defines the delete on exit Singleton traits we like. Best to have this 27 // Defines the delete on exit Singleton traits we like. Best to have this
28 // and const/dest private as recommended for Singletons. 28 // and const/dest private as recommended for Singletons.
29 friend struct DefaultSingletonTraits<XInputHierarchyChangedEventListener>; 29 friend struct base::DefaultSingletonTraits<
30 XInputHierarchyChangedEventListener>;
30 31
31 XInputHierarchyChangedEventListener(); 32 XInputHierarchyChangedEventListener();
32 ~XInputHierarchyChangedEventListener() override; 33 ~XInputHierarchyChangedEventListener() override;
33 34
34 // ui::PlatformEventObserver: 35 // ui::PlatformEventObserver:
35 void WillProcessEvent(const ui::PlatformEvent& event) override; 36 void WillProcessEvent(const ui::PlatformEvent& event) override;
36 void DidProcessEvent(const ui::PlatformEvent& event) override; 37 void DidProcessEvent(const ui::PlatformEvent& event) override;
37 38
38 // Returns true if the event was processed, false otherwise. 39 // Returns true if the event was processed, false otherwise.
39 void ProcessedXEvent(XEvent* xevent); 40 void ProcessedXEvent(XEvent* xevent);
40 41
41 bool stopped_; 42 bool stopped_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(XInputHierarchyChangedEventListener); 44 DISALLOW_COPY_AND_ASSIGN(XInputHierarchyChangedEventListener);
44 }; 45 };
45 46
46 } // namespace chromeos 47 } // namespace chromeos
47 48
48 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENE R_H_ 49 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698