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

Side by Side Diff: ui/events/devices/x11/device_list_cache_x11.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 UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_ 5 #ifndef UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
6 #define UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_ 6 #define UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
7 7
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 10
11 #include <map> 11 #include <map>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "ui/events/devices/events_devices_export.h" 15 #include "ui/events/devices/events_devices_export.h"
16 #include "ui/gfx/x/x11_types.h" 16 #include "ui/gfx/x/x11_types.h"
17 17
18 namespace base {
18 template <typename T> struct DefaultSingletonTraits; 19 template <typename T> struct DefaultSingletonTraits;
20 }
19 21
20 typedef struct _XDisplay Display; 22 typedef struct _XDisplay Display;
21 23
22 template <typename T, void (*D)(T*)> 24 template <typename T, void (*D)(T*)>
23 struct DeviceList { 25 struct DeviceList {
24 DeviceList() : count(0) {} 26 DeviceList() : count(0) {}
25 T& operator[](int x) { return devices[x]; } 27 T& operator[](int x) { return devices[x]; }
26 const T& operator[](int x) const { return devices[x]; } 28 const T& operator[](int x) const { return devices[x]; }
27 scoped_ptr<T[], gfx::XObjectDeleter<T, void, D>> devices; 29 scoped_ptr<T[], gfx::XObjectDeleter<T, void, D>> devices;
28 int count; 30 int count;
(...skipping 17 matching lines...) Expand all
46 // protocol to get the list of the devices. 48 // protocol to get the list of the devices.
47 const XDeviceList& GetXDeviceList(Display* display); 49 const XDeviceList& GetXDeviceList(Display* display);
48 50
49 // Returns the list of devices associated with |display|. Uses the newer 51 // Returns the list of devices associated with |display|. Uses the newer
50 // XINPUT2 protocol to get the list of devices. Before making this call, make 52 // XINPUT2 protocol to get the list of devices. Before making this call, make
51 // sure that XInput2 support is available (e.g. by calling 53 // sure that XInput2 support is available (e.g. by calling
52 // IsXInput2Available()). 54 // IsXInput2Available()).
53 const XIDeviceList& GetXI2DeviceList(Display* display); 55 const XIDeviceList& GetXI2DeviceList(Display* display);
54 56
55 private: 57 private:
56 friend struct DefaultSingletonTraits<DeviceListCacheX11>; 58 friend struct base::DefaultSingletonTraits<DeviceListCacheX11>;
57 59
58 DeviceListCacheX11(); 60 DeviceListCacheX11();
59 ~DeviceListCacheX11(); 61 ~DeviceListCacheX11();
60 62
61 XDeviceList x_dev_list_; 63 XDeviceList x_dev_list_;
62 XIDeviceList xi_dev_list_; 64 XIDeviceList xi_dev_list_;
63 65
64 DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX11); 66 DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX11);
65 }; 67 };
66 68
67 } // namespace ui 69 } // namespace ui
68 70
69 #endif // UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_ 71 #endif // UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
70 72
OLDNEW
« no previous file with comments | « ui/chromeos/ime/input_method_menu_manager.cc ('k') | ui/events/devices/x11/device_list_cache_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698