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

Side by Side Diff: content/browser/gamepad/gamepad_service.h

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 10
10 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 17
18 namespace blink { 18 namespace blink {
19 class WebGamepad; 19 class WebGamepad;
20 } 20 }
21 21
22 namespace content { 22 namespace content {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 private: 82 private:
83 friend struct base::DefaultSingletonTraits<GamepadService>; 83 friend struct base::DefaultSingletonTraits<GamepadService>;
84 friend class GamepadServiceTestConstructor; 84 friend class GamepadServiceTestConstructor;
85 friend class GamepadServiceTest; 85 friend class GamepadServiceTest;
86 86
87 GamepadService(); 87 GamepadService();
88 88
89 // Constructor for testing. This specifies the data fetcher to use for a 89 // Constructor for testing. This specifies the data fetcher to use for a
90 // provider, bypassing the default platform one. 90 // provider, bypassing the default platform one.
91 GamepadService(scoped_ptr<GamepadDataFetcher> fetcher); 91 GamepadService(std::unique_ptr<GamepadDataFetcher> fetcher);
92 92
93 virtual ~GamepadService(); 93 virtual ~GamepadService();
94 94
95 static void SetInstance(GamepadService*); 95 static void SetInstance(GamepadService*);
96 96
97 void OnUserGesture(); 97 void OnUserGesture();
98 98
99 struct ConsumerInfo { 99 struct ConsumerInfo {
100 ConsumerInfo(GamepadConsumer* consumer) 100 ConsumerInfo(GamepadConsumer* consumer)
101 : consumer(consumer), 101 : consumer(consumer),
102 did_observe_user_gesture(false) { 102 did_observe_user_gesture(false) {
103 } 103 }
104 104
105 bool operator<(const ConsumerInfo& other) const { 105 bool operator<(const ConsumerInfo& other) const {
106 return consumer < other.consumer; 106 return consumer < other.consumer;
107 } 107 }
108 108
109 GamepadConsumer* consumer; 109 GamepadConsumer* consumer;
110 mutable bool is_active; 110 mutable bool is_active;
111 mutable bool did_observe_user_gesture; 111 mutable bool did_observe_user_gesture;
112 }; 112 };
113 113
114 scoped_ptr<GamepadProvider> provider_; 114 std::unique_ptr<GamepadProvider> provider_;
115 115
116 base::ThreadChecker thread_checker_; 116 base::ThreadChecker thread_checker_;
117 117
118 typedef std::set<ConsumerInfo> ConsumerSet; 118 typedef std::set<ConsumerInfo> ConsumerSet;
119 ConsumerSet consumers_; 119 ConsumerSet consumers_;
120 120
121 int num_active_consumers_; 121 int num_active_consumers_;
122 122
123 bool gesture_callback_pending_; 123 bool gesture_callback_pending_;
124 124
125 DISALLOW_COPY_AND_ASSIGN(GamepadService); 125 DISALLOW_COPY_AND_ASSIGN(GamepadService);
126 }; 126 };
127 127
128 } // namespace content 128 } // namespace content
129 129
130 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ 130 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_provider_unittest.cc ('k') | content/browser/gamepad/gamepad_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698