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

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

Issue 517493003: Chromecast devtools delegate fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: always bundle Created 6 years, 3 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 | « chromecast/shell/browser/devtools/cast_dev_tools_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 11 matching lines...) Expand all
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[] =
34 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html";
35 #endif // defined(OS_ANDROID)
36 const int kDefaultRemoteDebuggingPort = 9222; 32 const int kDefaultRemoteDebuggingPort = 9222;
37 33
38 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
39 class UnixDomainServerSocketFactory 35 class UnixDomainServerSocketFactory
40 : public content::DevToolsHttpHandler::ServerSocketFactory { 36 : public content::DevToolsHttpHandler::ServerSocketFactory {
41 public: 37 public:
42 explicit UnixDomainServerSocketFactory(const std::string& socket_name) 38 explicit UnixDomainServerSocketFactory(const std::string& socket_name)
43 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} 39 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {}
44 40
45 private: 41 private:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 switches::kRemoteDebuggingSocketName); 78 switches::kRemoteDebuggingSocketName);
83 } 79 }
84 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( 80 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>(
85 new UnixDomainServerSocketFactory(socket_name)); 81 new UnixDomainServerSocketFactory(socket_name));
86 #else 82 #else
87 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( 83 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>(
88 new TCPServerSocketFactory("0.0.0.0", port, 1)); 84 new TCPServerSocketFactory("0.0.0.0", port, 1));
89 #endif 85 #endif
90 } 86 }
91 87
92 std::string GetFrontendUrl() {
93 #if defined(OS_ANDROID)
94 return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str());
95 #else
96 return std::string();
97 #endif // defined(OS_ANDROID)
98 }
99
100 } // namespace 88 } // namespace
101 89
102 RemoteDebuggingServer::RemoteDebuggingServer() 90 RemoteDebuggingServer::RemoteDebuggingServer()
103 : devtools_http_handler_(NULL), 91 : devtools_http_handler_(NULL),
104 port_(0) { 92 port_(0) {
105 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 93 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
106 pref_port_.Init(prefs::kRemoteDebuggingPort, 94 pref_port_.Init(prefs::kRemoteDebuggingPort,
107 ChromecastConfig::GetInstance()->pref_service(), 95 ChromecastConfig::GetInstance()->pref_service(),
108 base::Bind(&RemoteDebuggingServer::OnPortChanged, 96 base::Bind(&RemoteDebuggingServer::OnPortChanged,
109 base::Unretained(this))); 97 base::Unretained(this)));
(...skipping 27 matching lines...) Expand all
137 LOG(INFO) << "Stop old devtools: port=" << port_; 125 LOG(INFO) << "Stop old devtools: port=" << port_;
138 // Note: Stop destroys devtools_http_handler_. 126 // Note: Stop destroys devtools_http_handler_.
139 devtools_http_handler_->Stop(); 127 devtools_http_handler_->Stop();
140 devtools_http_handler_ = NULL; 128 devtools_http_handler_ = NULL;
141 } 129 }
142 130
143 port_ = new_port; 131 port_ = new_port;
144 if (port_ > 0) { 132 if (port_ > 0) {
145 devtools_http_handler_ = content::DevToolsHttpHandler::Start( 133 devtools_http_handler_ = content::DevToolsHttpHandler::Start(
146 CreateSocketFactory(port_), 134 CreateSocketFactory(port_),
147 GetFrontendUrl(), 135 std::string(),
148 new CastDevToolsDelegate(), 136 new CastDevToolsDelegate(),
149 base::FilePath()); 137 base::FilePath());
150 LOG(INFO) << "Devtools started: port=" << port_; 138 LOG(INFO) << "Devtools started: port=" << port_;
151 } 139 }
152 } 140 }
153 141
154 } // namespace shell 142 } // namespace shell
155 } // namespace chromecast 143 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/shell/browser/devtools/cast_dev_tools_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698