Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "android_webview/browser/aw_devtools_delegate.h" | 5 #include "android_webview/browser/aw_devtools_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/in_process_view_renderer.h" | 7 #include "android_webview/browser/in_process_view_renderer.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "content/public/browser/android/devtools_auth.h" | 12 #include "components/devtools_remote_frontend/devtools_auth_android.h" |
| 13 #include "components/devtools_remote_frontend/devtools_remote_frontend_util.h" | |
| 13 #include "content/public/browser/devtools_http_handler.h" | 14 #include "content/public/browser/devtools_http_handler.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 16 #include "net/socket/unix_domain_socket_posix.h" | 17 #include "net/socket/unix_domain_socket_posix.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; | 21 const char kSocketNameFormat[] = "%s_%d"; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace android_webview { | 24 namespace android_webview { |
| 24 | 25 |
| 25 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) | 26 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) |
| 26 : browser_context_(browser_context) { | 27 : browser_context_(browser_context) { |
| 28 const std::string socket_name = | |
| 29 devtools_remote_frontend::GetDevToolsServerSocketName("webview"); | |
|
pfeldman
2013/06/20 12:37:11
This only makes sense for android, just hardcode i
mnaganov (inactive)
2013/06/20 16:48:08
Done.
| |
| 27 devtools_http_handler_ = content::DevToolsHttpHandler::Start( | 30 devtools_http_handler_ = content::DevToolsHttpHandler::Start( |
| 28 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 31 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
| 29 base::StringPrintf(kSocketNameFormat, getpid()), | 32 base::StringPrintf(kSocketNameFormat, |
| 33 socket_name.c_str(), | |
| 34 getpid()), | |
| 30 "", | 35 "", |
| 31 base::Bind(&content::CanUserConnectToDevTools)), | 36 base::Bind(&devtools_remote_frontend::CanUserConnectToDevTools)), |
| 32 "", | 37 devtools_remote_frontend::GetDevToolsFrontendMainResourceURL(), |
|
pfeldman
2013/06/20 12:37:11
ditto
mnaganov (inactive)
2013/06/20 16:48:08
Done.
| |
| 33 this); | 38 this); |
| 34 } | 39 } |
| 35 | 40 |
| 36 AwDevToolsDelegate::~AwDevToolsDelegate() { | 41 AwDevToolsDelegate::~AwDevToolsDelegate() { |
| 37 } | 42 } |
| 38 | 43 |
| 39 void AwDevToolsDelegate::Stop() { | 44 void AwDevToolsDelegate::Stop() { |
| 40 devtools_http_handler_->Stop(); | 45 devtools_http_handler_->Stop(); |
| 41 // WARNING: |this| has now been deleted by the method above. | 46 // WARNING: |this| has now been deleted by the method above. |
| 42 } | 47 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 " <th style='width:100px; text-align:left;'>Size</th>" | 187 " <th style='width:100px; text-align:left;'>Size</th>" |
| 183 " </tr>" | 188 " </tr>" |
| 184 " <tbody id='items'></tbody>" | 189 " <tbody id='items'></tbody>" |
| 185 " </table>" | 190 " </table>" |
| 186 "</body>" | 191 "</body>" |
| 187 "</html>"; | 192 "</html>"; |
| 188 return html; | 193 return html; |
| 189 } | 194 } |
| 190 | 195 |
| 191 bool AwDevToolsDelegate::BundlesFrontendResources() { | 196 bool AwDevToolsDelegate::BundlesFrontendResources() { |
| 192 return true; | 197 return false; |
| 193 } | 198 } |
| 194 | 199 |
| 195 base::FilePath AwDevToolsDelegate::GetDebugFrontendDir() { | 200 base::FilePath AwDevToolsDelegate::GetDebugFrontendDir() { |
| 196 return base::FilePath(); | 201 return base::FilePath(); |
| 197 } | 202 } |
| 198 | 203 |
| 199 std::string AwDevToolsDelegate::GetPageThumbnailData(const GURL& url) { | 204 std::string AwDevToolsDelegate::GetPageThumbnailData(const GURL& url) { |
| 200 return ""; | 205 return ""; |
| 201 } | 206 } |
| 202 | 207 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 } | 240 } |
| 236 | 241 |
| 237 scoped_refptr<net::StreamListenSocket> | 242 scoped_refptr<net::StreamListenSocket> |
| 238 AwDevToolsDelegate::CreateSocketForTethering( | 243 AwDevToolsDelegate::CreateSocketForTethering( |
| 239 net::StreamListenSocket::Delegate* delegate, | 244 net::StreamListenSocket::Delegate* delegate, |
| 240 std::string* name) { | 245 std::string* name) { |
| 241 return NULL; | 246 return NULL; |
| 242 } | 247 } |
| 243 | 248 |
| 244 } // namespace android_webview | 249 } // namespace android_webview |
| OLD | NEW |