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

Side by Side Diff: chrome/browser/extensions/api/socket/socket_api.h

Issue 10388186: RefCounted types should not have public destructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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_EXTENSIONS_API_SOCKET_SOCKET_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/extensions/api/api_function.h" 10 #include "chrome/browser/extensions/api/api_function.h"
11 #include "chrome/common/extensions/api/experimental_socket.h" 11 #include "chrome/common/extensions/api/experimental_socket.h"
12 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
13 13
14 #include <string> 14 #include <string>
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 class APIResourceController; 18 class APIResourceController;
19 class APIResourceEventNotifier; 19 class APIResourceEventNotifier;
20 20
21 extern const char kBytesWrittenKey[]; 21 extern const char kBytesWrittenKey[];
22 extern const char kSocketIdKey[]; 22 extern const char kSocketIdKey[];
23 extern const char kUdpSocketType[]; 23 extern const char kUdpSocketType[];
24 24
25 class SocketExtensionFunction : public AsyncAPIFunction { 25 class SocketExtensionFunction : public AsyncAPIFunction {
26 public: 26 protected:
27 virtual ~SocketExtensionFunction() {}
28
29 // AsyncAPIFunction:
27 virtual void Work() OVERRIDE; 30 virtual void Work() OVERRIDE;
28 virtual bool Respond() OVERRIDE; 31 virtual bool Respond() OVERRIDE;
29 }; 32 };
30 33
31 // Many of these socket functions are synchronous in the sense that 34 // Many of these socket functions are synchronous in the sense that
32 // they don't involve blocking operations, but we've made them all 35 // they don't involve blocking operations, but we've made them all
33 // AsyncExtensionFunctions because the underlying UDPClientSocket 36 // AsyncExtensionFunctions because the underlying UDPClientSocket
34 // library wants all operations to happen on the same thread as the 37 // library wants all operations to happen on the same thread as the
35 // one that created the socket. Too bad. 38 // one that created the socket. Too bad.
36 39
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 104
102 // AsyncAPIFunction: 105 // AsyncAPIFunction:
103 virtual bool Prepare() OVERRIDE; 106 virtual bool Prepare() OVERRIDE;
104 virtual void Work() OVERRIDE; 107 virtual void Work() OVERRIDE;
105 108
106 private: 109 private:
107 int socket_id_; 110 int socket_id_;
108 }; 111 };
109 112
110 class SocketBindFunction : public SocketExtensionFunction { 113 class SocketBindFunction : public SocketExtensionFunction {
114 public:
115 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.bind")
116
111 protected: 117 protected:
118 virtual ~SocketBindFunction() {}
119
120 // AsyncAPIFunction:
112 virtual bool Prepare() OVERRIDE; 121 virtual bool Prepare() OVERRIDE;
113 virtual void Work() OVERRIDE; 122 virtual void Work() OVERRIDE;
114 123
115 private: 124 private:
116 int socket_id_; 125 int socket_id_;
117 std::string address_; 126 std::string address_;
118 int port_; 127 int port_;
119
120 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.bind")
121 }; 128 };
122 129
123 class SocketReadFunction : public SocketExtensionFunction { 130 class SocketReadFunction : public SocketExtensionFunction {
124 public: 131 public:
125 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.read") 132 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.read")
126 133
127 SocketReadFunction(); 134 SocketReadFunction();
128 135
129 protected: 136 protected:
130 virtual ~SocketReadFunction(); 137 virtual ~SocketReadFunction();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int socket_id_; 204 int socket_id_;
198 scoped_refptr<net::IOBuffer> io_buffer_; 205 scoped_refptr<net::IOBuffer> io_buffer_;
199 size_t io_buffer_size_; 206 size_t io_buffer_size_;
200 std::string address_; 207 std::string address_;
201 int port_; 208 int port_;
202 }; 209 };
203 210
204 } // namespace extensions 211 } // namespace extensions
205 212
206 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ 213 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/runtime/runtime_api.h ('k') | chrome/browser/extensions/api/usb/usb_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698