| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell_devtools_delegate.h" | 5 #include "content/shell/shell_devtools_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/public/browser/devtools_http_handler.h" | 8 #include "content/public/browser/devtools_http_handler.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context, | 27 ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context, |
| 28 int port) | 28 int port) |
| 29 : browser_context_(browser_context) { | 29 : browser_context_(browser_context) { |
| 30 devtools_http_handler_ = DevToolsHttpHandler::Start( | 30 devtools_http_handler_ = DevToolsHttpHandler::Start( |
| 31 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
| 32 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 32 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
| 33 kSocketName, | 33 kSocketName, base::Bind(&CanUserConnectToDevTools)), |
| 34 base::Bind(&CanUserConnectToDevTools)), | |
| 35 #else | 34 #else |
| 36 new net::TCPListenSocketFactory("127.0.0.1", port), | 35 new net::TCPListenSocketFactory("127.0.0.1", port), |
| 37 #endif | 36 #endif |
| 38 "", | 37 std::string(), |
| 39 this); | 38 this); |
| 40 } | 39 } |
| 41 | 40 |
| 42 ShellDevToolsDelegate::~ShellDevToolsDelegate() { | 41 ShellDevToolsDelegate::~ShellDevToolsDelegate() { |
| 43 } | 42 } |
| 44 | 43 |
| 45 void ShellDevToolsDelegate::Stop() { | 44 void ShellDevToolsDelegate::Stop() { |
| 46 // The call below destroys this. | 45 // The call below destroys this. |
| 47 devtools_http_handler_->Stop(); | 46 devtools_http_handler_->Stop(); |
| 48 } | 47 } |
| 49 | 48 |
| 50 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { | 49 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { |
| 51 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 50 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 52 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); | 51 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); |
| 53 } | 52 } |
| 54 | 53 |
| 55 bool ShellDevToolsDelegate::BundlesFrontendResources() { | 54 bool ShellDevToolsDelegate::BundlesFrontendResources() { |
| 56 return true; | 55 return true; |
| 57 } | 56 } |
| 58 | 57 |
| 59 base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { | 58 base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { |
| 60 return base::FilePath(); | 59 return base::FilePath(); |
| 61 } | 60 } |
| 62 | 61 |
| 63 std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) { | 62 std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) { |
| 64 return ""; | 63 return std::string(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 RenderViewHost* ShellDevToolsDelegate::CreateNewTarget() { | 66 RenderViewHost* ShellDevToolsDelegate::CreateNewTarget() { |
| 68 Shell* shell = Shell::CreateNewWindow(browser_context_, | 67 Shell* shell = Shell::CreateNewWindow(browser_context_, |
| 69 GURL(chrome::kAboutBlankURL), | 68 GURL(chrome::kAboutBlankURL), |
| 70 NULL, | 69 NULL, |
| 71 MSG_ROUTING_NONE, | 70 MSG_ROUTING_NONE, |
| 72 gfx::Size()); | 71 gfx::Size()); |
| 73 return shell->web_contents()->GetRenderViewHost(); | 72 return shell->web_contents()->GetRenderViewHost(); |
| 74 } | 73 } |
| 75 | 74 |
| 76 DevToolsHttpHandlerDelegate::TargetType | 75 DevToolsHttpHandlerDelegate::TargetType |
| 77 ShellDevToolsDelegate::GetTargetType(RenderViewHost*) { | 76 ShellDevToolsDelegate::GetTargetType(RenderViewHost*) { |
| 78 return kTargetTypeTab; | 77 return kTargetTypeTab; |
| 79 } | 78 } |
| 80 | 79 |
| 81 std::string ShellDevToolsDelegate::GetViewDescription( | 80 std::string ShellDevToolsDelegate::GetViewDescription( |
| 82 content::RenderViewHost*) { | 81 content::RenderViewHost*) { |
| 83 return ""; | 82 return std::string(); |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // namespace content | 85 } // namespace content |
| OLD | NEW |