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

Side by Side Diff: extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h

Issue 622343002: replace OVERRIDE and FINAL with override and final in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 26 matching lines...) Expand all
37 // follows the pattern of AsyncApiFunction, but does not derive from it, 37 // follows the pattern of AsyncApiFunction, but does not derive from it,
38 // because BluetoothApiSocket methods must be called on the UI Thread. 38 // because BluetoothApiSocket methods must be called on the UI Thread.
39 class BluetoothSocketAsyncApiFunction : public AsyncExtensionFunction { 39 class BluetoothSocketAsyncApiFunction : public AsyncExtensionFunction {
40 public: 40 public:
41 BluetoothSocketAsyncApiFunction(); 41 BluetoothSocketAsyncApiFunction();
42 42
43 protected: 43 protected:
44 virtual ~BluetoothSocketAsyncApiFunction(); 44 virtual ~BluetoothSocketAsyncApiFunction();
45 45
46 // AsyncExtensionFunction: 46 // AsyncExtensionFunction:
47 virtual bool RunAsync() OVERRIDE; 47 virtual bool RunAsync() override;
48 48
49 bool PrePrepare(); 49 bool PrePrepare();
50 bool Respond(); 50 bool Respond();
51 void AsyncWorkCompleted(); 51 void AsyncWorkCompleted();
52 52
53 virtual bool Prepare() = 0; 53 virtual bool Prepare() = 0;
54 virtual void Work(); 54 virtual void Work();
55 virtual void AsyncWorkStart(); 55 virtual void AsyncWorkStart();
56 56
57 content::BrowserThread::ID work_thread_id() const; 57 content::BrowserThread::ID work_thread_id() const;
(...skipping 10 matching lines...) Expand all
68 class BluetoothSocketCreateFunction : public BluetoothSocketAsyncApiFunction { 68 class BluetoothSocketCreateFunction : public BluetoothSocketAsyncApiFunction {
69 public: 69 public:
70 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.create", BLUETOOTHSOCKET_CREATE); 70 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.create", BLUETOOTHSOCKET_CREATE);
71 71
72 BluetoothSocketCreateFunction(); 72 BluetoothSocketCreateFunction();
73 73
74 protected: 74 protected:
75 virtual ~BluetoothSocketCreateFunction(); 75 virtual ~BluetoothSocketCreateFunction();
76 76
77 // BluetoothSocketAsyncApiFunction: 77 // BluetoothSocketAsyncApiFunction:
78 virtual bool Prepare() OVERRIDE; 78 virtual bool Prepare() override;
79 virtual void Work() OVERRIDE; 79 virtual void Work() override;
80 80
81 private: 81 private:
82 scoped_ptr<bluetooth_socket::Create::Params> params_; 82 scoped_ptr<bluetooth_socket::Create::Params> params_;
83 }; 83 };
84 84
85 class BluetoothSocketUpdateFunction : public BluetoothSocketAsyncApiFunction { 85 class BluetoothSocketUpdateFunction : public BluetoothSocketAsyncApiFunction {
86 public: 86 public:
87 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.update", BLUETOOTHSOCKET_UPDATE); 87 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.update", BLUETOOTHSOCKET_UPDATE);
88 88
89 BluetoothSocketUpdateFunction(); 89 BluetoothSocketUpdateFunction();
90 90
91 protected: 91 protected:
92 virtual ~BluetoothSocketUpdateFunction(); 92 virtual ~BluetoothSocketUpdateFunction();
93 93
94 // BluetoothSocketAsyncApiFunction: 94 // BluetoothSocketAsyncApiFunction:
95 virtual bool Prepare() OVERRIDE; 95 virtual bool Prepare() override;
96 virtual void Work() OVERRIDE; 96 virtual void Work() override;
97 97
98 private: 98 private:
99 scoped_ptr<bluetooth_socket::Update::Params> params_; 99 scoped_ptr<bluetooth_socket::Update::Params> params_;
100 }; 100 };
101 101
102 class BluetoothSocketSetPausedFunction 102 class BluetoothSocketSetPausedFunction
103 : public BluetoothSocketAsyncApiFunction { 103 : public BluetoothSocketAsyncApiFunction {
104 public: 104 public:
105 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.setPaused", 105 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.setPaused",
106 BLUETOOTHSOCKET_SETPAUSED); 106 BLUETOOTHSOCKET_SETPAUSED);
107 107
108 BluetoothSocketSetPausedFunction(); 108 BluetoothSocketSetPausedFunction();
109 109
110 protected: 110 protected:
111 virtual ~BluetoothSocketSetPausedFunction(); 111 virtual ~BluetoothSocketSetPausedFunction();
112 112
113 // BluetoothSocketAsyncApiFunction: 113 // BluetoothSocketAsyncApiFunction:
114 virtual bool Prepare() OVERRIDE; 114 virtual bool Prepare() override;
115 virtual void Work() OVERRIDE; 115 virtual void Work() override;
116 116
117 private: 117 private:
118 scoped_ptr<bluetooth_socket::SetPaused::Params> params_; 118 scoped_ptr<bluetooth_socket::SetPaused::Params> params_;
119 BluetoothSocketEventDispatcher* socket_event_dispatcher_; 119 BluetoothSocketEventDispatcher* socket_event_dispatcher_;
120 }; 120 };
121 121
122 class BluetoothSocketListenFunction : public BluetoothSocketAsyncApiFunction { 122 class BluetoothSocketListenFunction : public BluetoothSocketAsyncApiFunction {
123 public: 123 public:
124 BluetoothSocketListenFunction(); 124 BluetoothSocketListenFunction();
125 125
126 virtual bool CreateParams() = 0; 126 virtual bool CreateParams() = 0;
127 virtual void CreateService( 127 virtual void CreateService(
128 scoped_refptr<device::BluetoothAdapter> adapter, 128 scoped_refptr<device::BluetoothAdapter> adapter,
129 const device::BluetoothUUID& uuid, 129 const device::BluetoothUUID& uuid,
130 scoped_ptr<std::string> name, 130 scoped_ptr<std::string> name,
131 const device::BluetoothAdapter::CreateServiceCallback& callback, 131 const device::BluetoothAdapter::CreateServiceCallback& callback,
132 const device::BluetoothAdapter::CreateServiceErrorCallback& 132 const device::BluetoothAdapter::CreateServiceErrorCallback&
133 error_callback) = 0; 133 error_callback) = 0;
134 virtual void CreateResults() = 0; 134 virtual void CreateResults() = 0;
135 135
136 virtual int socket_id() const = 0; 136 virtual int socket_id() const = 0;
137 virtual const std::string& uuid() const = 0; 137 virtual const std::string& uuid() const = 0;
138 138
139 // BluetoothSocketAsyncApiFunction: 139 // BluetoothSocketAsyncApiFunction:
140 virtual bool Prepare() OVERRIDE; 140 virtual bool Prepare() override;
141 virtual void AsyncWorkStart() OVERRIDE; 141 virtual void AsyncWorkStart() override;
142 142
143 protected: 143 protected:
144 virtual ~BluetoothSocketListenFunction(); 144 virtual ~BluetoothSocketListenFunction();
145 145
146 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); 146 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
147 virtual void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); 147 virtual void OnCreateService(scoped_refptr<device::BluetoothSocket> socket);
148 virtual void OnCreateServiceError(const std::string& message); 148 virtual void OnCreateServiceError(const std::string& message);
149 149
150 BluetoothSocketEventDispatcher* socket_event_dispatcher_; 150 BluetoothSocketEventDispatcher* socket_event_dispatcher_;
151 }; 151 };
152 152
153 class BluetoothSocketListenUsingRfcommFunction 153 class BluetoothSocketListenUsingRfcommFunction
154 : public BluetoothSocketListenFunction { 154 : public BluetoothSocketListenFunction {
155 public: 155 public:
156 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingRfcomm", 156 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingRfcomm",
157 BLUETOOTHSOCKET_LISTENUSINGRFCOMM); 157 BLUETOOTHSOCKET_LISTENUSINGRFCOMM);
158 158
159 BluetoothSocketListenUsingRfcommFunction(); 159 BluetoothSocketListenUsingRfcommFunction();
160 160
161 // BluetoothSocketListenFunction: 161 // BluetoothSocketListenFunction:
162 virtual int socket_id() const OVERRIDE; 162 virtual int socket_id() const override;
163 virtual const std::string& uuid() const OVERRIDE; 163 virtual const std::string& uuid() const override;
164 164
165 virtual bool CreateParams() OVERRIDE; 165 virtual bool CreateParams() override;
166 virtual void CreateService( 166 virtual void CreateService(
167 scoped_refptr<device::BluetoothAdapter> adapter, 167 scoped_refptr<device::BluetoothAdapter> adapter,
168 const device::BluetoothUUID& uuid, 168 const device::BluetoothUUID& uuid,
169 scoped_ptr<std::string> name, 169 scoped_ptr<std::string> name,
170 const device::BluetoothAdapter::CreateServiceCallback& callback, 170 const device::BluetoothAdapter::CreateServiceCallback& callback,
171 const device::BluetoothAdapter::CreateServiceErrorCallback& 171 const device::BluetoothAdapter::CreateServiceErrorCallback&
172 error_callback) OVERRIDE; 172 error_callback) override;
173 virtual void CreateResults() OVERRIDE; 173 virtual void CreateResults() override;
174 174
175 protected: 175 protected:
176 virtual ~BluetoothSocketListenUsingRfcommFunction(); 176 virtual ~BluetoothSocketListenUsingRfcommFunction();
177 177
178 private: 178 private:
179 scoped_ptr<bluetooth_socket::ListenUsingRfcomm::Params> params_; 179 scoped_ptr<bluetooth_socket::ListenUsingRfcomm::Params> params_;
180 }; 180 };
181 181
182 class BluetoothSocketListenUsingL2capFunction 182 class BluetoothSocketListenUsingL2capFunction
183 : public BluetoothSocketListenFunction { 183 : public BluetoothSocketListenFunction {
184 public: 184 public:
185 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingL2cap", 185 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingL2cap",
186 BLUETOOTHSOCKET_LISTENUSINGL2CAP); 186 BLUETOOTHSOCKET_LISTENUSINGL2CAP);
187 187
188 BluetoothSocketListenUsingL2capFunction(); 188 BluetoothSocketListenUsingL2capFunction();
189 189
190 // BluetoothSocketListenFunction: 190 // BluetoothSocketListenFunction:
191 virtual int socket_id() const OVERRIDE; 191 virtual int socket_id() const override;
192 virtual const std::string& uuid() const OVERRIDE; 192 virtual const std::string& uuid() const override;
193 193
194 virtual bool CreateParams() OVERRIDE; 194 virtual bool CreateParams() override;
195 virtual void CreateService( 195 virtual void CreateService(
196 scoped_refptr<device::BluetoothAdapter> adapter, 196 scoped_refptr<device::BluetoothAdapter> adapter,
197 const device::BluetoothUUID& uuid, 197 const device::BluetoothUUID& uuid,
198 scoped_ptr<std::string> name, 198 scoped_ptr<std::string> name,
199 const device::BluetoothAdapter::CreateServiceCallback& callback, 199 const device::BluetoothAdapter::CreateServiceCallback& callback,
200 const device::BluetoothAdapter::CreateServiceErrorCallback& 200 const device::BluetoothAdapter::CreateServiceErrorCallback&
201 error_callback) OVERRIDE; 201 error_callback) override;
202 virtual void CreateResults() OVERRIDE; 202 virtual void CreateResults() override;
203 203
204 protected: 204 protected:
205 virtual ~BluetoothSocketListenUsingL2capFunction(); 205 virtual ~BluetoothSocketListenUsingL2capFunction();
206 206
207 private: 207 private:
208 scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_; 208 scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_;
209 }; 209 };
210 210
211 class BluetoothSocketAbstractConnectFunction : 211 class BluetoothSocketAbstractConnectFunction :
212 public BluetoothSocketAsyncApiFunction { 212 public BluetoothSocketAsyncApiFunction {
213 public: 213 public:
214 BluetoothSocketAbstractConnectFunction(); 214 BluetoothSocketAbstractConnectFunction();
215 215
216 protected: 216 protected:
217 virtual ~BluetoothSocketAbstractConnectFunction(); 217 virtual ~BluetoothSocketAbstractConnectFunction();
218 218
219 // BluetoothSocketAsyncApiFunction: 219 // BluetoothSocketAsyncApiFunction:
220 virtual bool Prepare() OVERRIDE; 220 virtual bool Prepare() override;
221 virtual void AsyncWorkStart() OVERRIDE; 221 virtual void AsyncWorkStart() override;
222 222
223 // Subclasses should implement this method to connect to the service 223 // Subclasses should implement this method to connect to the service
224 // registered with |uuid| on the |device|. 224 // registered with |uuid| on the |device|.
225 virtual void ConnectToService(device::BluetoothDevice* device, 225 virtual void ConnectToService(device::BluetoothDevice* device,
226 const device::BluetoothUUID& uuid) = 0; 226 const device::BluetoothUUID& uuid) = 0;
227 227
228 virtual void OnConnect(scoped_refptr<device::BluetoothSocket> socket); 228 virtual void OnConnect(scoped_refptr<device::BluetoothSocket> socket);
229 virtual void OnConnectError(const std::string& message); 229 virtual void OnConnectError(const std::string& message);
230 230
231 private: 231 private:
232 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); 232 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
233 233
234 scoped_ptr<bluetooth_socket::Connect::Params> params_; 234 scoped_ptr<bluetooth_socket::Connect::Params> params_;
235 BluetoothSocketEventDispatcher* socket_event_dispatcher_; 235 BluetoothSocketEventDispatcher* socket_event_dispatcher_;
236 }; 236 };
237 237
238 class BluetoothSocketConnectFunction : 238 class BluetoothSocketConnectFunction :
239 public BluetoothSocketAbstractConnectFunction { 239 public BluetoothSocketAbstractConnectFunction {
240 public: 240 public:
241 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect", 241 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect",
242 BLUETOOTHSOCKET_CONNECT); 242 BLUETOOTHSOCKET_CONNECT);
243 243
244 BluetoothSocketConnectFunction(); 244 BluetoothSocketConnectFunction();
245 245
246 protected: 246 protected:
247 virtual ~BluetoothSocketConnectFunction(); 247 virtual ~BluetoothSocketConnectFunction();
248 248
249 // BluetoothSocketAbstractConnectFunction: 249 // BluetoothSocketAbstractConnectFunction:
250 virtual void ConnectToService(device::BluetoothDevice* device, 250 virtual void ConnectToService(device::BluetoothDevice* device,
251 const device::BluetoothUUID& uuid) OVERRIDE; 251 const device::BluetoothUUID& uuid) override;
252 }; 252 };
253 253
254 class BluetoothSocketDisconnectFunction 254 class BluetoothSocketDisconnectFunction
255 : public BluetoothSocketAsyncApiFunction { 255 : public BluetoothSocketAsyncApiFunction {
256 public: 256 public:
257 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.disconnect", 257 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.disconnect",
258 BLUETOOTHSOCKET_DISCONNECT); 258 BLUETOOTHSOCKET_DISCONNECT);
259 259
260 BluetoothSocketDisconnectFunction(); 260 BluetoothSocketDisconnectFunction();
261 261
262 protected: 262 protected:
263 virtual ~BluetoothSocketDisconnectFunction(); 263 virtual ~BluetoothSocketDisconnectFunction();
264 264
265 // BluetoothSocketAsyncApiFunction: 265 // BluetoothSocketAsyncApiFunction:
266 virtual bool Prepare() OVERRIDE; 266 virtual bool Prepare() override;
267 virtual void AsyncWorkStart() OVERRIDE; 267 virtual void AsyncWorkStart() override;
268 268
269 private: 269 private:
270 virtual void OnSuccess(); 270 virtual void OnSuccess();
271 271
272 scoped_ptr<bluetooth_socket::Disconnect::Params> params_; 272 scoped_ptr<bluetooth_socket::Disconnect::Params> params_;
273 }; 273 };
274 274
275 class BluetoothSocketCloseFunction : public BluetoothSocketAsyncApiFunction { 275 class BluetoothSocketCloseFunction : public BluetoothSocketAsyncApiFunction {
276 public: 276 public:
277 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.close", BLUETOOTHSOCKET_CLOSE); 277 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.close", BLUETOOTHSOCKET_CLOSE);
278 278
279 BluetoothSocketCloseFunction(); 279 BluetoothSocketCloseFunction();
280 280
281 protected: 281 protected:
282 virtual ~BluetoothSocketCloseFunction(); 282 virtual ~BluetoothSocketCloseFunction();
283 283
284 // BluetoothSocketAsyncApiFunction: 284 // BluetoothSocketAsyncApiFunction:
285 virtual bool Prepare() OVERRIDE; 285 virtual bool Prepare() override;
286 virtual void Work() OVERRIDE; 286 virtual void Work() override;
287 287
288 private: 288 private:
289 scoped_ptr<bluetooth_socket::Close::Params> params_; 289 scoped_ptr<bluetooth_socket::Close::Params> params_;
290 }; 290 };
291 291
292 class BluetoothSocketSendFunction : public BluetoothSocketAsyncApiFunction { 292 class BluetoothSocketSendFunction : public BluetoothSocketAsyncApiFunction {
293 public: 293 public:
294 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.send", BLUETOOTHSOCKET_SEND); 294 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.send", BLUETOOTHSOCKET_SEND);
295 295
296 BluetoothSocketSendFunction(); 296 BluetoothSocketSendFunction();
297 297
298 protected: 298 protected:
299 virtual ~BluetoothSocketSendFunction(); 299 virtual ~BluetoothSocketSendFunction();
300 300
301 // BluetoothSocketAsyncApiFunction: 301 // BluetoothSocketAsyncApiFunction:
302 virtual bool Prepare() OVERRIDE; 302 virtual bool Prepare() override;
303 virtual void AsyncWorkStart() OVERRIDE; 303 virtual void AsyncWorkStart() override;
304 304
305 private: 305 private:
306 void OnSuccess(int bytes_sent); 306 void OnSuccess(int bytes_sent);
307 void OnError(BluetoothApiSocket::ErrorReason reason, 307 void OnError(BluetoothApiSocket::ErrorReason reason,
308 const std::string& message); 308 const std::string& message);
309 309
310 scoped_ptr<bluetooth_socket::Send::Params> params_; 310 scoped_ptr<bluetooth_socket::Send::Params> params_;
311 scoped_refptr<net::IOBuffer> io_buffer_; 311 scoped_refptr<net::IOBuffer> io_buffer_;
312 size_t io_buffer_size_; 312 size_t io_buffer_size_;
313 }; 313 };
314 314
315 class BluetoothSocketGetInfoFunction : public BluetoothSocketAsyncApiFunction { 315 class BluetoothSocketGetInfoFunction : public BluetoothSocketAsyncApiFunction {
316 public: 316 public:
317 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getInfo", 317 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getInfo",
318 BLUETOOTHSOCKET_GETINFO); 318 BLUETOOTHSOCKET_GETINFO);
319 319
320 BluetoothSocketGetInfoFunction(); 320 BluetoothSocketGetInfoFunction();
321 321
322 protected: 322 protected:
323 virtual ~BluetoothSocketGetInfoFunction(); 323 virtual ~BluetoothSocketGetInfoFunction();
324 324
325 // BluetoothSocketAsyncApiFunction: 325 // BluetoothSocketAsyncApiFunction:
326 virtual bool Prepare() OVERRIDE; 326 virtual bool Prepare() override;
327 virtual void Work() OVERRIDE; 327 virtual void Work() override;
328 328
329 private: 329 private:
330 scoped_ptr<bluetooth_socket::GetInfo::Params> params_; 330 scoped_ptr<bluetooth_socket::GetInfo::Params> params_;
331 }; 331 };
332 332
333 class BluetoothSocketGetSocketsFunction 333 class BluetoothSocketGetSocketsFunction
334 : public BluetoothSocketAsyncApiFunction { 334 : public BluetoothSocketAsyncApiFunction {
335 public: 335 public:
336 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getSockets", 336 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getSockets",
337 BLUETOOTHSOCKET_GETSOCKETS); 337 BLUETOOTHSOCKET_GETSOCKETS);
338 338
339 BluetoothSocketGetSocketsFunction(); 339 BluetoothSocketGetSocketsFunction();
340 340
341 protected: 341 protected:
342 virtual ~BluetoothSocketGetSocketsFunction(); 342 virtual ~BluetoothSocketGetSocketsFunction();
343 343
344 // BluetoothSocketAsyncApiFunction: 344 // BluetoothSocketAsyncApiFunction:
345 virtual bool Prepare() OVERRIDE; 345 virtual bool Prepare() override;
346 virtual void Work() OVERRIDE; 346 virtual void Work() override;
347 }; 347 };
348 348
349 } // namespace core_api 349 } // namespace core_api
350 } // namespace extensions 350 } // namespace extensions
351 351
352 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ 352 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698