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

Side by Side Diff: chromecast/shell/browser/devtools/remote_debugging_server.cc

Issue 490603002: Chromecast: initial checkin of Android-based cast shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 #include "chromecast/shell/browser/devtools/remote_debugging_server.h" 5 #include "chromecast/shell/browser/devtools/remote_debugging_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "chromecast/common/chromecast_config.h" 12 #include "chromecast/common/chromecast_config.h"
13 #include "chromecast/common/pref_names.h" 13 #include "chromecast/common/pref_names.h"
14 #include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" 14 #include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/devtools_http_handler.h" 17 #include "content/public/browser/devtools_http_handler.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/common/user_agent.h" 19 #include "content/public/common/user_agent.h"
20 #include "net/socket/tcp_listen_socket.h" 20 #include "net/socket/tcp_listen_socket.h"
21 21
22 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
23 #include "content/public/browser/android/devtools_auth.h" 23 #include "content/public/browser/android/devtools_auth.h"
24 #include "net/socket/unix_domain_socket_posix.h" 24 #include "net/socket/unix_domain_listen_socket_posix.h"
25 #endif // defined(OS_ANDROID) 25 #endif // defined(OS_ANDROID)
26 26
27 namespace chromecast { 27 namespace chromecast {
28 namespace shell { 28 namespace shell {
29 29
30 namespace { 30 namespace {
31 31
32 #if defined(OS_ANDROID) 32 #if defined(OS_ANDROID)
33 const char kFrontEndURL[] = 33 const char kFrontEndURL[] =
34 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; 34 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html";
35 #endif // defined(OS_ANDROID) 35 #endif // defined(OS_ANDROID)
36 const int kDefaultRemoteDebuggingPort = 9222; 36 const int kDefaultRemoteDebuggingPort = 9222;
37 37
38 net::StreamListenSocketFactory* CreateSocketFactory(int port) { 38 net::StreamListenSocketFactory* CreateSocketFactory(int port) {
39 #if defined(OS_ANDROID) 39 #if defined(OS_ANDROID)
40 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 40 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
41 std::string socket_name = "content_shell_devtools_remote"; 41 std::string socket_name = "content_shell_devtools_remote";
42 if (command_line->HasSwitch(switches::kRemoteDebuggingSocketName)) { 42 if (command_line->HasSwitch(switches::kRemoteDebuggingSocketName)) {
43 socket_name = command_line->GetSwitchValueASCII( 43 socket_name = command_line->GetSwitchValueASCII(
44 switches::kRemoteDebuggingSocketName); 44 switches::kRemoteDebuggingSocketName);
45 } 45 }
46 return new net::UnixDomainSocketWithAbstractNamespaceFactory( 46 return new net::deprecated::
47 socket_name, "", base::Bind(&content::CanUserConnectToDevTools)); 47 UnixDomainListenSocketWithAbstractNamespaceFactory(
Yaron 2014/08/20 18:11:02 This is being changed in https://codereview.chromi
gunsch 2014/08/21 22:31:28 Acknowledged. Reviewed that CL for Byungchul but e
48 socket_name, "", base::Bind(&content::CanUserConnectToDevTools));
48 #else 49 #else
49 return new net::TCPListenSocketFactory("0.0.0.0", port); 50 return new net::TCPListenSocketFactory("0.0.0.0", port);
50 #endif // defined(OS_ANDROID) 51 #endif // defined(OS_ANDROID)
51 } 52 }
52 53
53 std::string GetFrontendUrl() { 54 std::string GetFrontendUrl() {
54 #if defined(OS_ANDROID) 55 #if defined(OS_ANDROID)
55 return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()); 56 return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str());
56 #else 57 #else
57 return std::string(); 58 return std::string();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 CreateSocketFactory(port_), 108 CreateSocketFactory(port_),
108 GetFrontendUrl(), 109 GetFrontendUrl(),
109 new CastDevToolsDelegate(), 110 new CastDevToolsDelegate(),
110 base::FilePath()); 111 base::FilePath());
111 LOG(INFO) << "Devtools started: port=" << port_; 112 LOG(INFO) << "Devtools started: port=" << port_;
112 } 113 }
113 } 114 }
114 115
115 } // namespace shell 116 } // namespace shell
116 } // namespace chromecast 117 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698