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 "chromecast/browser/devtools/remote_debugging_server.h" | 5 #include "chromecast/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" |
(...skipping 11 matching lines...) Expand all Loading... |
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_server_socket_posix.h" | 24 #include "net/socket/unix_domain_server_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) | |
33 const char kFrontEndURL[] = | 32 const char kFrontEndURL[] = |
34 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; | 33 "https://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; |
35 #endif // defined(OS_ANDROID) | |
36 const int kDefaultRemoteDebuggingPort = 9222; | 34 const int kDefaultRemoteDebuggingPort = 9222; |
37 | 35 |
38 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
39 class UnixDomainServerSocketFactory | 37 class UnixDomainServerSocketFactory |
40 : public content::DevToolsHttpHandler::ServerSocketFactory { | 38 : public content::DevToolsHttpHandler::ServerSocketFactory { |
41 public: | 39 public: |
42 explicit UnixDomainServerSocketFactory(const std::string& socket_name) | 40 explicit UnixDomainServerSocketFactory(const std::string& socket_name) |
43 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} | 41 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} |
44 | 42 |
45 private: | 43 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 81 } |
84 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( | 82 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( |
85 new UnixDomainServerSocketFactory(socket_name)); | 83 new UnixDomainServerSocketFactory(socket_name)); |
86 #else | 84 #else |
87 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( | 85 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( |
88 new TCPServerSocketFactory("0.0.0.0", port, 1)); | 86 new TCPServerSocketFactory("0.0.0.0", port, 1)); |
89 #endif | 87 #endif |
90 } | 88 } |
91 | 89 |
92 std::string GetFrontendUrl() { | 90 std::string GetFrontendUrl() { |
93 #if defined(OS_ANDROID) | |
94 return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()); | 91 return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()); |
95 #else | |
96 return std::string(); | |
97 #endif // defined(OS_ANDROID) | |
98 } | 92 } |
99 | 93 |
100 } // namespace | 94 } // namespace |
101 | 95 |
102 RemoteDebuggingServer::RemoteDebuggingServer() | 96 RemoteDebuggingServer::RemoteDebuggingServer() |
103 : devtools_http_handler_(NULL), | 97 : devtools_http_handler_(NULL), |
104 port_(0) { | 98 port_(0) { |
105 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
106 pref_port_.Init(prefs::kRemoteDebuggingPort, | 100 pref_port_.Init(prefs::kRemoteDebuggingPort, |
107 ChromecastConfig::GetInstance()->pref_service(), | 101 ChromecastConfig::GetInstance()->pref_service(), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 CreateSocketFactory(port_), | 140 CreateSocketFactory(port_), |
147 GetFrontendUrl(), | 141 GetFrontendUrl(), |
148 new CastDevToolsDelegate(), | 142 new CastDevToolsDelegate(), |
149 base::FilePath()); | 143 base::FilePath()); |
150 LOG(INFO) << "Devtools started: port=" << port_; | 144 LOG(INFO) << "Devtools started: port=" << port_; |
151 } | 145 } |
152 } | 146 } |
153 | 147 |
154 } // namespace shell | 148 } // namespace shell |
155 } // namespace chromecast | 149 } // namespace chromecast |
OLD | NEW |