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

Side by Side Diff: extensions/browser/api/socket/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_SOCKET_SOCKET_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_ 6 #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const std::string& extension_id) = 0; 51 const std::string& extension_id) = 0;
52 }; 52 };
53 53
54 // Implementation of SocketResourceManagerInterface using an 54 // Implementation of SocketResourceManagerInterface using an
55 // ApiResourceManager<T> instance (where T derives from Socket). 55 // ApiResourceManager<T> instance (where T derives from Socket).
56 template <typename T> 56 template <typename T>
57 class SocketResourceManager : public SocketResourceManagerInterface { 57 class SocketResourceManager : public SocketResourceManagerInterface {
58 public: 58 public:
59 SocketResourceManager() : manager_(NULL) {} 59 SocketResourceManager() : manager_(NULL) {}
60 60
61 virtual bool SetBrowserContext(content::BrowserContext* context) OVERRIDE { 61 virtual bool SetBrowserContext(content::BrowserContext* context) override {
62 manager_ = ApiResourceManager<T>::Get(context); 62 manager_ = ApiResourceManager<T>::Get(context);
63 DCHECK(manager_) 63 DCHECK(manager_)
64 << "There is no socket manager. " 64 << "There is no socket manager. "
65 "If this assertion is failing during a test, then it is likely that " 65 "If this assertion is failing during a test, then it is likely that "
66 "TestExtensionSystem is failing to provide an instance of " 66 "TestExtensionSystem is failing to provide an instance of "
67 "ApiResourceManager<Socket>."; 67 "ApiResourceManager<Socket>.";
68 return manager_ != NULL; 68 return manager_ != NULL;
69 } 69 }
70 70
71 virtual int Add(Socket* socket) OVERRIDE { 71 virtual int Add(Socket* socket) override {
72 // Note: Cast needed here, because "T" may be a subclass of "Socket". 72 // Note: Cast needed here, because "T" may be a subclass of "Socket".
73 return manager_->Add(static_cast<T*>(socket)); 73 return manager_->Add(static_cast<T*>(socket));
74 } 74 }
75 75
76 virtual Socket* Get(const std::string& extension_id, 76 virtual Socket* Get(const std::string& extension_id,
77 int api_resource_id) OVERRIDE { 77 int api_resource_id) override {
78 return manager_->Get(extension_id, api_resource_id); 78 return manager_->Get(extension_id, api_resource_id);
79 } 79 }
80 80
81 virtual void Replace(const std::string& extension_id, 81 virtual void Replace(const std::string& extension_id,
82 int api_resource_id, 82 int api_resource_id,
83 Socket* socket) OVERRIDE { 83 Socket* socket) override {
84 manager_->Replace(extension_id, api_resource_id, static_cast<T*>(socket)); 84 manager_->Replace(extension_id, api_resource_id, static_cast<T*>(socket));
85 } 85 }
86 86
87 virtual void Remove(const std::string& extension_id, 87 virtual void Remove(const std::string& extension_id,
88 int api_resource_id) OVERRIDE { 88 int api_resource_id) override {
89 manager_->Remove(extension_id, api_resource_id); 89 manager_->Remove(extension_id, api_resource_id);
90 } 90 }
91 91
92 virtual base::hash_set<int>* GetResourceIds(const std::string& extension_id) 92 virtual base::hash_set<int>* GetResourceIds(const std::string& extension_id)
93 OVERRIDE { 93 override {
94 return manager_->GetResourceIds(extension_id); 94 return manager_->GetResourceIds(extension_id);
95 } 95 }
96 96
97 private: 97 private:
98 ApiResourceManager<T>* manager_; 98 ApiResourceManager<T>* manager_;
99 }; 99 };
100 100
101 class SocketAsyncApiFunction : public AsyncApiFunction { 101 class SocketAsyncApiFunction : public AsyncApiFunction {
102 public: 102 public:
103 SocketAsyncApiFunction(); 103 SocketAsyncApiFunction();
104 104
105 protected: 105 protected:
106 virtual ~SocketAsyncApiFunction(); 106 virtual ~SocketAsyncApiFunction();
107 107
108 // AsyncApiFunction: 108 // AsyncApiFunction:
109 virtual bool PrePrepare() OVERRIDE; 109 virtual bool PrePrepare() override;
110 virtual bool Respond() OVERRIDE; 110 virtual bool Respond() override;
111 111
112 virtual scoped_ptr<SocketResourceManagerInterface> 112 virtual scoped_ptr<SocketResourceManagerInterface>
113 CreateSocketResourceManager(); 113 CreateSocketResourceManager();
114 114
115 int AddSocket(Socket* socket); 115 int AddSocket(Socket* socket);
116 Socket* GetSocket(int api_resource_id); 116 Socket* GetSocket(int api_resource_id);
117 void ReplaceSocket(int api_resource_id, Socket* socket); 117 void ReplaceSocket(int api_resource_id, Socket* socket);
118 void RemoveSocket(int api_resource_id); 118 void RemoveSocket(int api_resource_id);
119 base::hash_set<int>* GetSocketIds(); 119 base::hash_set<int>* GetSocketIds();
120 120
121 private: 121 private:
122 scoped_ptr<SocketResourceManagerInterface> manager_; 122 scoped_ptr<SocketResourceManagerInterface> manager_;
123 }; 123 };
124 124
125 class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction { 125 class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction {
126 protected: 126 protected:
127 SocketExtensionWithDnsLookupFunction(); 127 SocketExtensionWithDnsLookupFunction();
128 virtual ~SocketExtensionWithDnsLookupFunction(); 128 virtual ~SocketExtensionWithDnsLookupFunction();
129 129
130 // AsyncApiFunction: 130 // AsyncApiFunction:
131 virtual bool PrePrepare() OVERRIDE; 131 virtual bool PrePrepare() override;
132 132
133 void StartDnsLookup(const std::string& hostname); 133 void StartDnsLookup(const std::string& hostname);
134 virtual void AfterDnsLookup(int lookup_result) = 0; 134 virtual void AfterDnsLookup(int lookup_result) = 0;
135 135
136 std::string resolved_address_; 136 std::string resolved_address_;
137 137
138 private: 138 private:
139 void OnDnsLookup(int resolve_result); 139 void OnDnsLookup(int resolve_result);
140 140
141 // Weak pointer to the resource context. 141 // Weak pointer to the resource context.
142 content::ResourceContext* resource_context_; 142 content::ResourceContext* resource_context_;
143 143
144 scoped_ptr<net::HostResolver::RequestHandle> request_handle_; 144 scoped_ptr<net::HostResolver::RequestHandle> request_handle_;
145 scoped_ptr<net::AddressList> addresses_; 145 scoped_ptr<net::AddressList> addresses_;
146 }; 146 };
147 147
148 class SocketCreateFunction : public SocketAsyncApiFunction { 148 class SocketCreateFunction : public SocketAsyncApiFunction {
149 public: 149 public:
150 DECLARE_EXTENSION_FUNCTION("socket.create", SOCKET_CREATE) 150 DECLARE_EXTENSION_FUNCTION("socket.create", SOCKET_CREATE)
151 151
152 SocketCreateFunction(); 152 SocketCreateFunction();
153 153
154 protected: 154 protected:
155 virtual ~SocketCreateFunction(); 155 virtual ~SocketCreateFunction();
156 156
157 // AsyncApiFunction: 157 // AsyncApiFunction:
158 virtual bool Prepare() OVERRIDE; 158 virtual bool Prepare() override;
159 virtual void Work() OVERRIDE; 159 virtual void Work() override;
160 160
161 private: 161 private:
162 FRIEND_TEST_ALL_PREFIXES(SocketUnitTest, Create); 162 FRIEND_TEST_ALL_PREFIXES(SocketUnitTest, Create);
163 enum SocketType { kSocketTypeInvalid = -1, kSocketTypeTCP, kSocketTypeUDP }; 163 enum SocketType { kSocketTypeInvalid = -1, kSocketTypeTCP, kSocketTypeUDP };
164 164
165 scoped_ptr<core_api::socket::Create::Params> params_; 165 scoped_ptr<core_api::socket::Create::Params> params_;
166 SocketType socket_type_; 166 SocketType socket_type_;
167 }; 167 };
168 168
169 class SocketDestroyFunction : public SocketAsyncApiFunction { 169 class SocketDestroyFunction : public SocketAsyncApiFunction {
170 public: 170 public:
171 DECLARE_EXTENSION_FUNCTION("socket.destroy", SOCKET_DESTROY) 171 DECLARE_EXTENSION_FUNCTION("socket.destroy", SOCKET_DESTROY)
172 172
173 protected: 173 protected:
174 virtual ~SocketDestroyFunction() {} 174 virtual ~SocketDestroyFunction() {}
175 175
176 // AsyncApiFunction: 176 // AsyncApiFunction:
177 virtual bool Prepare() OVERRIDE; 177 virtual bool Prepare() override;
178 virtual void Work() OVERRIDE; 178 virtual void Work() override;
179 179
180 private: 180 private:
181 int socket_id_; 181 int socket_id_;
182 }; 182 };
183 183
184 class SocketConnectFunction : public SocketExtensionWithDnsLookupFunction { 184 class SocketConnectFunction : public SocketExtensionWithDnsLookupFunction {
185 public: 185 public:
186 DECLARE_EXTENSION_FUNCTION("socket.connect", SOCKET_CONNECT) 186 DECLARE_EXTENSION_FUNCTION("socket.connect", SOCKET_CONNECT)
187 187
188 SocketConnectFunction(); 188 SocketConnectFunction();
189 189
190 protected: 190 protected:
191 virtual ~SocketConnectFunction(); 191 virtual ~SocketConnectFunction();
192 192
193 // AsyncApiFunction: 193 // AsyncApiFunction:
194 virtual bool Prepare() OVERRIDE; 194 virtual bool Prepare() override;
195 virtual void AsyncWorkStart() OVERRIDE; 195 virtual void AsyncWorkStart() override;
196 196
197 // SocketExtensionWithDnsLookupFunction: 197 // SocketExtensionWithDnsLookupFunction:
198 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; 198 virtual void AfterDnsLookup(int lookup_result) override;
199 199
200 private: 200 private:
201 void StartConnect(); 201 void StartConnect();
202 void OnConnect(int result); 202 void OnConnect(int result);
203 203
204 int socket_id_; 204 int socket_id_;
205 std::string hostname_; 205 std::string hostname_;
206 int port_; 206 int port_;
207 }; 207 };
208 208
209 class SocketDisconnectFunction : public SocketAsyncApiFunction { 209 class SocketDisconnectFunction : public SocketAsyncApiFunction {
210 public: 210 public:
211 DECLARE_EXTENSION_FUNCTION("socket.disconnect", SOCKET_DISCONNECT) 211 DECLARE_EXTENSION_FUNCTION("socket.disconnect", SOCKET_DISCONNECT)
212 212
213 protected: 213 protected:
214 virtual ~SocketDisconnectFunction() {} 214 virtual ~SocketDisconnectFunction() {}
215 215
216 // AsyncApiFunction: 216 // AsyncApiFunction:
217 virtual bool Prepare() OVERRIDE; 217 virtual bool Prepare() override;
218 virtual void Work() OVERRIDE; 218 virtual void Work() override;
219 219
220 private: 220 private:
221 int socket_id_; 221 int socket_id_;
222 }; 222 };
223 223
224 class SocketBindFunction : public SocketAsyncApiFunction { 224 class SocketBindFunction : public SocketAsyncApiFunction {
225 public: 225 public:
226 DECLARE_EXTENSION_FUNCTION("socket.bind", SOCKET_BIND) 226 DECLARE_EXTENSION_FUNCTION("socket.bind", SOCKET_BIND)
227 227
228 protected: 228 protected:
229 virtual ~SocketBindFunction() {} 229 virtual ~SocketBindFunction() {}
230 230
231 // AsyncApiFunction: 231 // AsyncApiFunction:
232 virtual bool Prepare() OVERRIDE; 232 virtual bool Prepare() override;
233 virtual void Work() OVERRIDE; 233 virtual void Work() override;
234 234
235 private: 235 private:
236 int socket_id_; 236 int socket_id_;
237 std::string address_; 237 std::string address_;
238 int port_; 238 int port_;
239 }; 239 };
240 240
241 class SocketListenFunction : public SocketAsyncApiFunction { 241 class SocketListenFunction : public SocketAsyncApiFunction {
242 public: 242 public:
243 DECLARE_EXTENSION_FUNCTION("socket.listen", SOCKET_LISTEN) 243 DECLARE_EXTENSION_FUNCTION("socket.listen", SOCKET_LISTEN)
244 244
245 SocketListenFunction(); 245 SocketListenFunction();
246 246
247 protected: 247 protected:
248 virtual ~SocketListenFunction(); 248 virtual ~SocketListenFunction();
249 249
250 // AsyncApiFunction: 250 // AsyncApiFunction:
251 virtual bool Prepare() OVERRIDE; 251 virtual bool Prepare() override;
252 virtual void Work() OVERRIDE; 252 virtual void Work() override;
253 253
254 private: 254 private:
255 scoped_ptr<core_api::socket::Listen::Params> params_; 255 scoped_ptr<core_api::socket::Listen::Params> params_;
256 }; 256 };
257 257
258 class SocketAcceptFunction : public SocketAsyncApiFunction { 258 class SocketAcceptFunction : public SocketAsyncApiFunction {
259 public: 259 public:
260 DECLARE_EXTENSION_FUNCTION("socket.accept", SOCKET_ACCEPT) 260 DECLARE_EXTENSION_FUNCTION("socket.accept", SOCKET_ACCEPT)
261 261
262 SocketAcceptFunction(); 262 SocketAcceptFunction();
263 263
264 protected: 264 protected:
265 virtual ~SocketAcceptFunction(); 265 virtual ~SocketAcceptFunction();
266 266
267 // AsyncApiFunction: 267 // AsyncApiFunction:
268 virtual bool Prepare() OVERRIDE; 268 virtual bool Prepare() override;
269 virtual void AsyncWorkStart() OVERRIDE; 269 virtual void AsyncWorkStart() override;
270 270
271 private: 271 private:
272 void OnAccept(int result_code, net::TCPClientSocket* socket); 272 void OnAccept(int result_code, net::TCPClientSocket* socket);
273 273
274 scoped_ptr<core_api::socket::Accept::Params> params_; 274 scoped_ptr<core_api::socket::Accept::Params> params_;
275 }; 275 };
276 276
277 class SocketReadFunction : public SocketAsyncApiFunction { 277 class SocketReadFunction : public SocketAsyncApiFunction {
278 public: 278 public:
279 DECLARE_EXTENSION_FUNCTION("socket.read", SOCKET_READ) 279 DECLARE_EXTENSION_FUNCTION("socket.read", SOCKET_READ)
280 280
281 SocketReadFunction(); 281 SocketReadFunction();
282 282
283 protected: 283 protected:
284 virtual ~SocketReadFunction(); 284 virtual ~SocketReadFunction();
285 285
286 // AsyncApiFunction: 286 // AsyncApiFunction:
287 virtual bool Prepare() OVERRIDE; 287 virtual bool Prepare() override;
288 virtual void AsyncWorkStart() OVERRIDE; 288 virtual void AsyncWorkStart() override;
289 void OnCompleted(int result, scoped_refptr<net::IOBuffer> io_buffer); 289 void OnCompleted(int result, scoped_refptr<net::IOBuffer> io_buffer);
290 290
291 private: 291 private:
292 scoped_ptr<core_api::socket::Read::Params> params_; 292 scoped_ptr<core_api::socket::Read::Params> params_;
293 }; 293 };
294 294
295 class SocketWriteFunction : public SocketAsyncApiFunction { 295 class SocketWriteFunction : public SocketAsyncApiFunction {
296 public: 296 public:
297 DECLARE_EXTENSION_FUNCTION("socket.write", SOCKET_WRITE) 297 DECLARE_EXTENSION_FUNCTION("socket.write", SOCKET_WRITE)
298 298
299 SocketWriteFunction(); 299 SocketWriteFunction();
300 300
301 protected: 301 protected:
302 virtual ~SocketWriteFunction(); 302 virtual ~SocketWriteFunction();
303 303
304 // AsyncApiFunction: 304 // AsyncApiFunction:
305 virtual bool Prepare() OVERRIDE; 305 virtual bool Prepare() override;
306 virtual void AsyncWorkStart() OVERRIDE; 306 virtual void AsyncWorkStart() override;
307 void OnCompleted(int result); 307 void OnCompleted(int result);
308 308
309 private: 309 private:
310 int socket_id_; 310 int socket_id_;
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 SocketRecvFromFunction : public SocketAsyncApiFunction { 315 class SocketRecvFromFunction : public SocketAsyncApiFunction {
316 public: 316 public:
317 DECLARE_EXTENSION_FUNCTION("socket.recvFrom", SOCKET_RECVFROM) 317 DECLARE_EXTENSION_FUNCTION("socket.recvFrom", SOCKET_RECVFROM)
318 318
319 SocketRecvFromFunction(); 319 SocketRecvFromFunction();
320 320
321 protected: 321 protected:
322 virtual ~SocketRecvFromFunction(); 322 virtual ~SocketRecvFromFunction();
323 323
324 // AsyncApiFunction 324 // AsyncApiFunction
325 virtual bool Prepare() OVERRIDE; 325 virtual bool Prepare() override;
326 virtual void AsyncWorkStart() OVERRIDE; 326 virtual void AsyncWorkStart() override;
327 void OnCompleted(int result, 327 void OnCompleted(int result,
328 scoped_refptr<net::IOBuffer> io_buffer, 328 scoped_refptr<net::IOBuffer> io_buffer,
329 const std::string& address, 329 const std::string& address,
330 int port); 330 int port);
331 331
332 private: 332 private:
333 scoped_ptr<core_api::socket::RecvFrom::Params> params_; 333 scoped_ptr<core_api::socket::RecvFrom::Params> params_;
334 }; 334 };
335 335
336 class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction { 336 class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
337 public: 337 public:
338 DECLARE_EXTENSION_FUNCTION("socket.sendTo", SOCKET_SENDTO) 338 DECLARE_EXTENSION_FUNCTION("socket.sendTo", SOCKET_SENDTO)
339 339
340 SocketSendToFunction(); 340 SocketSendToFunction();
341 341
342 protected: 342 protected:
343 virtual ~SocketSendToFunction(); 343 virtual ~SocketSendToFunction();
344 344
345 // AsyncApiFunction: 345 // AsyncApiFunction:
346 virtual bool Prepare() OVERRIDE; 346 virtual bool Prepare() override;
347 virtual void AsyncWorkStart() OVERRIDE; 347 virtual void AsyncWorkStart() override;
348 void OnCompleted(int result); 348 void OnCompleted(int result);
349 349
350 // SocketExtensionWithDnsLookupFunction: 350 // SocketExtensionWithDnsLookupFunction:
351 virtual void AfterDnsLookup(int lookup_result) OVERRIDE; 351 virtual void AfterDnsLookup(int lookup_result) override;
352 352
353 private: 353 private:
354 void StartSendTo(); 354 void StartSendTo();
355 355
356 int socket_id_; 356 int socket_id_;
357 scoped_refptr<net::IOBuffer> io_buffer_; 357 scoped_refptr<net::IOBuffer> io_buffer_;
358 size_t io_buffer_size_; 358 size_t io_buffer_size_;
359 std::string hostname_; 359 std::string hostname_;
360 int port_; 360 int port_;
361 }; 361 };
362 362
363 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction { 363 class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
364 public: 364 public:
365 DECLARE_EXTENSION_FUNCTION("socket.setKeepAlive", SOCKET_SETKEEPALIVE) 365 DECLARE_EXTENSION_FUNCTION("socket.setKeepAlive", SOCKET_SETKEEPALIVE)
366 366
367 SocketSetKeepAliveFunction(); 367 SocketSetKeepAliveFunction();
368 368
369 protected: 369 protected:
370 virtual ~SocketSetKeepAliveFunction(); 370 virtual ~SocketSetKeepAliveFunction();
371 371
372 // AsyncApiFunction: 372 // AsyncApiFunction:
373 virtual bool Prepare() OVERRIDE; 373 virtual bool Prepare() override;
374 virtual void Work() OVERRIDE; 374 virtual void Work() override;
375 375
376 private: 376 private:
377 scoped_ptr<core_api::socket::SetKeepAlive::Params> params_; 377 scoped_ptr<core_api::socket::SetKeepAlive::Params> params_;
378 }; 378 };
379 379
380 class SocketSetNoDelayFunction : public SocketAsyncApiFunction { 380 class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
381 public: 381 public:
382 DECLARE_EXTENSION_FUNCTION("socket.setNoDelay", SOCKET_SETNODELAY) 382 DECLARE_EXTENSION_FUNCTION("socket.setNoDelay", SOCKET_SETNODELAY)
383 383
384 SocketSetNoDelayFunction(); 384 SocketSetNoDelayFunction();
385 385
386 protected: 386 protected:
387 virtual ~SocketSetNoDelayFunction(); 387 virtual ~SocketSetNoDelayFunction();
388 388
389 // AsyncApiFunction: 389 // AsyncApiFunction:
390 virtual bool Prepare() OVERRIDE; 390 virtual bool Prepare() override;
391 virtual void Work() OVERRIDE; 391 virtual void Work() override;
392 392
393 private: 393 private:
394 scoped_ptr<core_api::socket::SetNoDelay::Params> params_; 394 scoped_ptr<core_api::socket::SetNoDelay::Params> params_;
395 }; 395 };
396 396
397 class SocketGetInfoFunction : public SocketAsyncApiFunction { 397 class SocketGetInfoFunction : public SocketAsyncApiFunction {
398 public: 398 public:
399 DECLARE_EXTENSION_FUNCTION("socket.getInfo", SOCKET_GETINFO) 399 DECLARE_EXTENSION_FUNCTION("socket.getInfo", SOCKET_GETINFO)
400 400
401 SocketGetInfoFunction(); 401 SocketGetInfoFunction();
402 402
403 protected: 403 protected:
404 virtual ~SocketGetInfoFunction(); 404 virtual ~SocketGetInfoFunction();
405 405
406 // AsyncApiFunction: 406 // AsyncApiFunction:
407 virtual bool Prepare() OVERRIDE; 407 virtual bool Prepare() override;
408 virtual void Work() OVERRIDE; 408 virtual void Work() override;
409 409
410 private: 410 private:
411 scoped_ptr<core_api::socket::GetInfo::Params> params_; 411 scoped_ptr<core_api::socket::GetInfo::Params> params_;
412 }; 412 };
413 413
414 class SocketGetNetworkListFunction : public AsyncExtensionFunction { 414 class SocketGetNetworkListFunction : public AsyncExtensionFunction {
415 public: 415 public:
416 DECLARE_EXTENSION_FUNCTION("socket.getNetworkList", SOCKET_GETNETWORKLIST) 416 DECLARE_EXTENSION_FUNCTION("socket.getNetworkList", SOCKET_GETNETWORKLIST)
417 417
418 protected: 418 protected:
419 virtual ~SocketGetNetworkListFunction() {} 419 virtual ~SocketGetNetworkListFunction() {}
420 virtual bool RunAsync() OVERRIDE; 420 virtual bool RunAsync() override;
421 421
422 private: 422 private:
423 void GetNetworkListOnFileThread(); 423 void GetNetworkListOnFileThread();
424 void HandleGetNetworkListError(); 424 void HandleGetNetworkListError();
425 void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list); 425 void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list);
426 }; 426 };
427 427
428 class SocketJoinGroupFunction : public SocketAsyncApiFunction { 428 class SocketJoinGroupFunction : public SocketAsyncApiFunction {
429 public: 429 public:
430 DECLARE_EXTENSION_FUNCTION("socket.joinGroup", SOCKET_MULTICAST_JOIN_GROUP) 430 DECLARE_EXTENSION_FUNCTION("socket.joinGroup", SOCKET_MULTICAST_JOIN_GROUP)
431 431
432 SocketJoinGroupFunction(); 432 SocketJoinGroupFunction();
433 433
434 protected: 434 protected:
435 virtual ~SocketJoinGroupFunction(); 435 virtual ~SocketJoinGroupFunction();
436 436
437 // AsyncApiFunction 437 // AsyncApiFunction
438 virtual bool Prepare() OVERRIDE; 438 virtual bool Prepare() override;
439 virtual void Work() OVERRIDE; 439 virtual void Work() override;
440 440
441 private: 441 private:
442 scoped_ptr<core_api::socket::JoinGroup::Params> params_; 442 scoped_ptr<core_api::socket::JoinGroup::Params> params_;
443 }; 443 };
444 444
445 class SocketLeaveGroupFunction : public SocketAsyncApiFunction { 445 class SocketLeaveGroupFunction : public SocketAsyncApiFunction {
446 public: 446 public:
447 DECLARE_EXTENSION_FUNCTION("socket.leaveGroup", SOCKET_MULTICAST_LEAVE_GROUP) 447 DECLARE_EXTENSION_FUNCTION("socket.leaveGroup", SOCKET_MULTICAST_LEAVE_GROUP)
448 448
449 SocketLeaveGroupFunction(); 449 SocketLeaveGroupFunction();
450 450
451 protected: 451 protected:
452 virtual ~SocketLeaveGroupFunction(); 452 virtual ~SocketLeaveGroupFunction();
453 453
454 // AsyncApiFunction 454 // AsyncApiFunction
455 virtual bool Prepare() OVERRIDE; 455 virtual bool Prepare() override;
456 virtual void Work() OVERRIDE; 456 virtual void Work() override;
457 457
458 private: 458 private:
459 scoped_ptr<core_api::socket::LeaveGroup::Params> params_; 459 scoped_ptr<core_api::socket::LeaveGroup::Params> params_;
460 }; 460 };
461 461
462 class SocketSetMulticastTimeToLiveFunction : public SocketAsyncApiFunction { 462 class SocketSetMulticastTimeToLiveFunction : public SocketAsyncApiFunction {
463 public: 463 public:
464 DECLARE_EXTENSION_FUNCTION("socket.setMulticastTimeToLive", 464 DECLARE_EXTENSION_FUNCTION("socket.setMulticastTimeToLive",
465 SOCKET_MULTICAST_SET_TIME_TO_LIVE) 465 SOCKET_MULTICAST_SET_TIME_TO_LIVE)
466 466
467 SocketSetMulticastTimeToLiveFunction(); 467 SocketSetMulticastTimeToLiveFunction();
468 468
469 protected: 469 protected:
470 virtual ~SocketSetMulticastTimeToLiveFunction(); 470 virtual ~SocketSetMulticastTimeToLiveFunction();
471 471
472 // AsyncApiFunction 472 // AsyncApiFunction
473 virtual bool Prepare() OVERRIDE; 473 virtual bool Prepare() override;
474 virtual void Work() OVERRIDE; 474 virtual void Work() override;
475 475
476 private: 476 private:
477 scoped_ptr<core_api::socket::SetMulticastTimeToLive::Params> params_; 477 scoped_ptr<core_api::socket::SetMulticastTimeToLive::Params> params_;
478 }; 478 };
479 479
480 class SocketSetMulticastLoopbackModeFunction : public SocketAsyncApiFunction { 480 class SocketSetMulticastLoopbackModeFunction : public SocketAsyncApiFunction {
481 public: 481 public:
482 DECLARE_EXTENSION_FUNCTION("socket.setMulticastLoopbackMode", 482 DECLARE_EXTENSION_FUNCTION("socket.setMulticastLoopbackMode",
483 SOCKET_MULTICAST_SET_LOOPBACK_MODE) 483 SOCKET_MULTICAST_SET_LOOPBACK_MODE)
484 484
485 SocketSetMulticastLoopbackModeFunction(); 485 SocketSetMulticastLoopbackModeFunction();
486 486
487 protected: 487 protected:
488 virtual ~SocketSetMulticastLoopbackModeFunction(); 488 virtual ~SocketSetMulticastLoopbackModeFunction();
489 489
490 // AsyncApiFunction 490 // AsyncApiFunction
491 virtual bool Prepare() OVERRIDE; 491 virtual bool Prepare() override;
492 virtual void Work() OVERRIDE; 492 virtual void Work() override;
493 493
494 private: 494 private:
495 scoped_ptr<core_api::socket::SetMulticastLoopbackMode::Params> params_; 495 scoped_ptr<core_api::socket::SetMulticastLoopbackMode::Params> params_;
496 }; 496 };
497 497
498 class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction { 498 class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction {
499 public: 499 public:
500 DECLARE_EXTENSION_FUNCTION("socket.getJoinedGroups", 500 DECLARE_EXTENSION_FUNCTION("socket.getJoinedGroups",
501 SOCKET_MULTICAST_GET_JOINED_GROUPS) 501 SOCKET_MULTICAST_GET_JOINED_GROUPS)
502 502
503 SocketGetJoinedGroupsFunction(); 503 SocketGetJoinedGroupsFunction();
504 504
505 protected: 505 protected:
506 virtual ~SocketGetJoinedGroupsFunction(); 506 virtual ~SocketGetJoinedGroupsFunction();
507 507
508 // AsyncApiFunction 508 // AsyncApiFunction
509 virtual bool Prepare() OVERRIDE; 509 virtual bool Prepare() override;
510 virtual void Work() OVERRIDE; 510 virtual void Work() override;
511 511
512 private: 512 private:
513 scoped_ptr<core_api::socket::GetJoinedGroups::Params> params_; 513 scoped_ptr<core_api::socket::GetJoinedGroups::Params> params_;
514 }; 514 };
515 515
516 class SocketSecureFunction : public SocketAsyncApiFunction { 516 class SocketSecureFunction : public SocketAsyncApiFunction {
517 public: 517 public:
518 DECLARE_EXTENSION_FUNCTION("socket.secure", SOCKET_SECURE); 518 DECLARE_EXTENSION_FUNCTION("socket.secure", SOCKET_SECURE);
519 SocketSecureFunction(); 519 SocketSecureFunction();
520 520
521 protected: 521 protected:
522 virtual ~SocketSecureFunction(); 522 virtual ~SocketSecureFunction();
523 523
524 // AsyncApiFunction 524 // AsyncApiFunction
525 virtual bool Prepare() OVERRIDE; 525 virtual bool Prepare() override;
526 virtual void AsyncWorkStart() OVERRIDE; 526 virtual void AsyncWorkStart() override;
527 527
528 private: 528 private:
529 // Callback from TLSSocket::UpgradeSocketToTLS(). 529 // Callback from TLSSocket::UpgradeSocketToTLS().
530 void TlsConnectDone(scoped_ptr<TLSSocket> socket, int result); 530 void TlsConnectDone(scoped_ptr<TLSSocket> socket, int result);
531 531
532 scoped_ptr<core_api::socket::Secure::Params> params_; 532 scoped_ptr<core_api::socket::Secure::Params> params_;
533 scoped_refptr<net::URLRequestContextGetter> url_request_getter_; 533 scoped_refptr<net::URLRequestContextGetter> url_request_getter_;
534 534
535 DISALLOW_COPY_AND_ASSIGN(SocketSecureFunction); 535 DISALLOW_COPY_AND_ASSIGN(SocketSecureFunction);
536 }; 536 };
537 537
538 } // namespace extensions 538 } // namespace extensions
539 539
540 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_ 540 #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/serial/serial_connection.cc ('k') | extensions/browser/api/socket/tcp_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698