Index: content/shell/browser/shell_devtools_delegate.cc |
diff --git a/content/shell/browser/shell_devtools_delegate.cc b/content/shell/browser/shell_devtools_delegate.cc |
index 2768f8b7e60189e6fdc3181c1436a6beee8c31b4..589a14bc1bc7533781e79eb1f80700f0c3a2fb8a 100644 |
--- a/content/shell/browser/shell_devtools_delegate.cc |
+++ b/content/shell/browser/shell_devtools_delegate.cc |
@@ -24,12 +24,12 @@ |
#include "content/public/common/user_agent.h" |
#include "content/shell/browser/shell.h" |
#include "grit/shell_resources.h" |
-#include "net/socket/tcp_listen_socket.h" |
+#include "net/socket/tcp_server_socket.h" |
#include "ui/base/resource/resource_bundle.h" |
#if defined(OS_ANDROID) |
#include "content/public/browser/android/devtools_auth.h" |
-#include "net/socket/unix_domain_listen_socket_posix.h" |
+#include "net/socket/unix_domain_server_socket_posix.h" |
#endif |
using content::DevToolsAgentHost; |
@@ -44,7 +44,45 @@ const char kFrontEndURL[] = |
#endif |
const char kTargetTypePage[] = "page"; |
-net::StreamListenSocketFactory* CreateSocketFactory() { |
+#if defined(OS_ANDROID) |
+class UnixDomainServerSocketFactory |
+ : public content::DevToolsHttpHandler::ServerSocketFactory { |
+ public: |
+ explicit UnixDomainServerSocketFactory(const std::string& socket_name) |
+ : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} |
+ |
+ private: |
+ // content::DevToolsHttpHandler::ServerSocketFactory. |
+ virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { |
+ return scoped_ptr<net::ServerSocket>( |
+ new net::UnixDomainServerSocket( |
+ base::Bind(&content::CanUserConnectToDevTools), |
+ true)); |
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); |
+}; |
+#else |
+class TCPServerSocketFactory |
+ : public content::DevToolsHttpHandler::ServerSocketFactory { |
+ public: |
+ TCPServerSocketFactory(const std::string& address, int port, int backlog) |
+ : content::DevToolsHttpHandler::ServerSocketFactory( |
+ address, port, backlog) {} |
+ |
+ private: |
+ // content::DevToolsHttpHandler::ServerSocketFactory. |
+ virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { |
+ return scoped_ptr<net::ServerSocket>( |
+ new net::TCPServerSocket(NULL, net::NetLog::Source())); |
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); |
+}; |
+#endif |
+ |
+scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> |
+CreateSocketFactory() { |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
#if defined(OS_ANDROID) |
std::string socket_name = "content_shell_devtools_remote"; |
@@ -52,9 +90,8 @@ net::StreamListenSocketFactory* CreateSocketFactory() { |
socket_name = command_line.GetSwitchValueASCII( |
switches::kRemoteDebuggingSocketName); |
} |
- return new net::deprecated:: |
- UnixDomainListenSocketWithAbstractNamespaceFactory( |
- socket_name, "", base::Bind(&content::CanUserConnectToDevTools)); |
+ return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( |
+ new UnixDomainServerSocketFactory(socket_name)); |
#else |
// See if the user specified a port on the command line (useful for |
// automation). If not, use an ephemeral port by specifying 0. |
@@ -70,7 +107,8 @@ net::StreamListenSocketFactory* CreateSocketFactory() { |
DLOG(WARNING) << "Invalid http debugger port number " << temp_port; |
} |
} |
- return new net::TCPListenSocketFactory("127.0.0.1", port); |
+ return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( |
+ new TCPServerSocketFactory("127.0.0.1", port, 1)); |
#endif |
} |