OLD | NEW |
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 #include "extensions/browser/api/socket/socket.h" | 5 #include "extensions/browser/api/socket/socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "extensions/browser/api/api_resource_manager.h" | 9 #include "extensions/browser/api/api_resource_manager.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
12 #include "net/base/ip_address.h" | 12 #include "net/base/ip_address.h" |
13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/socket/socket.h" | 15 #include "net/socket/socket.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 const char kSocketTypeNotSupported[] = "Socket type does not support this API"; | 19 const char kSocketTypeNotSupported[] = "Socket type does not support this API"; |
20 | 20 |
21 static base::LazyInstance< | 21 static base::LazyInstance< |
22 BrowserContextKeyedAPIFactory<ApiResourceManager<Socket> > > g_factory = | 22 BrowserContextKeyedAPIFactory<ApiResourceManager<Socket>>>::DestructorAtExit |
23 LAZY_INSTANCE_INITIALIZER; | 23 g_factory = LAZY_INSTANCE_INITIALIZER; |
24 | 24 |
25 // static | 25 // static |
26 template <> | 26 template <> |
27 BrowserContextKeyedAPIFactory<ApiResourceManager<Socket> >* | 27 BrowserContextKeyedAPIFactory<ApiResourceManager<Socket> >* |
28 ApiResourceManager<Socket>::GetFactoryInstance() { | 28 ApiResourceManager<Socket>::GetFactoryInstance() { |
29 return g_factory.Pointer(); | 29 return g_factory.Pointer(); |
30 } | 30 } |
31 | 31 |
32 Socket::Socket(const std::string& owner_extension_id) | 32 Socket::Socket(const std::string& owner_extension_id) |
33 : ApiResource(owner_extension_id), is_connected_(false) {} | 33 : ApiResource(owner_extension_id), is_connected_(false) {} |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 : io_buffer(io_buffer), | 134 : io_buffer(io_buffer), |
135 byte_count(byte_count), | 135 byte_count(byte_count), |
136 callback(callback), | 136 callback(callback), |
137 bytes_written(0) {} | 137 bytes_written(0) {} |
138 | 138 |
139 Socket::WriteRequest::WriteRequest(const WriteRequest& other) = default; | 139 Socket::WriteRequest::WriteRequest(const WriteRequest& other) = default; |
140 | 140 |
141 Socket::WriteRequest::~WriteRequest() {} | 141 Socket::WriteRequest::~WriteRequest() {} |
142 | 142 |
143 } // namespace extensions | 143 } // namespace extensions |
OLD | NEW |