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

Side by Side Diff: content/shell/browser/shell_devtools_delegate.cc

Issue 376323002: Refactor unix domain socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved UnixDomainListenSocket to net::deprecated namespace. Created 6 years, 5 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
« no previous file with comments | « chrome/browser/android/dev_tools_server.cc ('k') | net/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_devtools_delegate.h" 5 #include "content/shell/browser/shell_devtools_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
24 #include "content/public/common/user_agent.h" 24 #include "content/public/common/user_agent.h"
25 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
26 #include "grit/shell_resources.h" 26 #include "grit/shell_resources.h"
27 #include "net/socket/tcp_listen_socket.h" 27 #include "net/socket/tcp_listen_socket.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 29
30 #if defined(OS_ANDROID) 30 #if defined(OS_ANDROID)
31 #include "content/public/browser/android/devtools_auth.h" 31 #include "content/public/browser/android/devtools_auth.h"
32 #include "net/socket/unix_domain_socket_posix.h" 32 #include "net/socket/unix_domain_listen_socket_posix.h"
33 #endif 33 #endif
34 34
35 using content::DevToolsAgentHost; 35 using content::DevToolsAgentHost;
36 using content::RenderViewHost; 36 using content::RenderViewHost;
37 using content::WebContents; 37 using content::WebContents;
38 38
39 namespace { 39 namespace {
40 40
41 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
42 const char kFrontEndURL[] = 42 const char kFrontEndURL[] =
43 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; 43 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html";
44 #endif 44 #endif
45 const char kTargetTypePage[] = "page"; 45 const char kTargetTypePage[] = "page";
46 46
47 net::StreamListenSocketFactory* CreateSocketFactory() { 47 net::StreamListenSocketFactory* CreateSocketFactory() {
48 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 48 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
49 #if defined(OS_ANDROID) 49 #if defined(OS_ANDROID)
50 std::string socket_name = "content_shell_devtools_remote"; 50 std::string socket_name = "content_shell_devtools_remote";
51 if (command_line.HasSwitch(switches::kRemoteDebuggingSocketName)) { 51 if (command_line.HasSwitch(switches::kRemoteDebuggingSocketName)) {
52 socket_name = command_line.GetSwitchValueASCII( 52 socket_name = command_line.GetSwitchValueASCII(
53 switches::kRemoteDebuggingSocketName); 53 switches::kRemoteDebuggingSocketName);
54 } 54 }
55 return new net::UnixDomainSocketWithAbstractNamespaceFactory( 55 return new net::deprecated::
56 socket_name, "", base::Bind(&content::CanUserConnectToDevTools)); 56 UnixDomainListenSocketWithAbstractNamespaceFactory(
57 socket_name, "", base::Bind(&content::CanUserConnectToDevTools));
57 #else 58 #else
58 // See if the user specified a port on the command line (useful for 59 // See if the user specified a port on the command line (useful for
59 // automation). If not, use an ephemeral port by specifying 0. 60 // automation). If not, use an ephemeral port by specifying 0.
60 int port = 0; 61 int port = 0;
61 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { 62 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
62 int temp_port; 63 int temp_port;
63 std::string port_str = 64 std::string port_str =
64 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); 65 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
65 if (base::StringToInt(port_str, &temp_port) && 66 if (base::StringToInt(port_str, &temp_port) &&
66 temp_port > 0 && temp_port < 65535) { 67 temp_port > 0 && temp_port < 65535) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 210 }
210 211
211 scoped_ptr<net::StreamListenSocket> 212 scoped_ptr<net::StreamListenSocket>
212 ShellDevToolsDelegate::CreateSocketForTethering( 213 ShellDevToolsDelegate::CreateSocketForTethering(
213 net::StreamListenSocket::Delegate* delegate, 214 net::StreamListenSocket::Delegate* delegate,
214 std::string* name) { 215 std::string* name) {
215 return scoped_ptr<net::StreamListenSocket>(); 216 return scoped_ptr<net::StreamListenSocket>();
216 } 217 }
217 218
218 } // namespace content 219 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/android/dev_tools_server.cc ('k') | net/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698