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

Unified Diff: content/shell/browser/shell_devtools_manager_delegate.cc

Issue 2300703005: DevTools: merge devtools_http_handler into content - it is used in all the embedders anyways. (Closed)
Patch Set: for review Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_devtools_manager_delegate.cc
diff --git a/content/shell/browser/shell_devtools_manager_delegate.cc b/content/shell/browser/shell_devtools_manager_delegate.cc
index 957f36b239283f1a526ae2259748d473d767f760..b6fe2ec550e81863e2f64ad10e5bd605ff2ad88d 100644
--- a/content/shell/browser/shell_devtools_manager_delegate.cc
+++ b/content/shell/browser/shell_devtools_manager_delegate.cc
@@ -17,7 +17,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
-#include "components/devtools_http_handler/devtools_http_handler.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_frontend_host.h"
@@ -41,8 +40,6 @@
#include "net/socket/unix_domain_server_socket_posix.h"
#endif
-using devtools_http_handler::DevToolsHttpHandler;
-
namespace content {
namespace {
@@ -141,64 +138,31 @@ std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() {
#endif
}
-// ShellDevToolsDelegate ----------------------------------------------------
-
-class ShellDevToolsDelegate :
- public devtools_http_handler::DevToolsHttpHandlerDelegate {
- public:
- explicit ShellDevToolsDelegate();
- ~ShellDevToolsDelegate() override;
-
- // devtools_http_handler::DevToolsHttpHandlerDelegate implementation.
- std::string GetDiscoveryPageHTML() override;
- std::string GetFrontendResource(const std::string& path) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ShellDevToolsDelegate);
-};
-
-ShellDevToolsDelegate::ShellDevToolsDelegate() {
-}
-
-ShellDevToolsDelegate::~ShellDevToolsDelegate() {
-}
-
-std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() {
-#if defined(OS_ANDROID)
- return std::string();
-#else
- return ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string();
-#endif
-}
-
-std::string ShellDevToolsDelegate::GetFrontendResource(
- const std::string& path) {
- return content::DevToolsFrontendHost::GetFrontendResource(path).as_string();
-}
-
-} // namespace
+} // namespace
// ShellDevToolsManagerDelegate ----------------------------------------------
// static
-DevToolsHttpHandler*
-ShellDevToolsManagerDelegate::CreateHttpHandler(
+void ShellDevToolsManagerDelegate::StartHttpHandler(
BrowserContext* browser_context) {
std::string frontend_url;
#if defined(OS_ANDROID)
frontend_url = base::StringPrintf(kFrontEndURL, GetWebKitRevision().c_str());
#endif
- return new DevToolsHttpHandler(
+ DevToolsAgentHost::StartRemoteDebuggingServer(
CreateSocketFactory(),
frontend_url,
- new ShellDevToolsDelegate(),
browser_context->GetPath(),
base::FilePath(),
std::string(),
GetShellUserAgent());
}
+// static
+void ShellDevToolsManagerDelegate::StopHttpHandler() {
+ DevToolsAgentHost::StopRemoteDebuggingServer();
+}
+
ShellDevToolsManagerDelegate::ShellDevToolsManagerDelegate(
BrowserContext* browser_context)
: browser_context_(browser_context) {
@@ -232,4 +196,18 @@ ShellDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
return DevToolsAgentHost::GetOrCreateFor(shell->web_contents());
}
+std::string ShellDevToolsManagerDelegate::GetDiscoveryPageHTML() {
+#if defined(OS_ANDROID)
+ return std::string();
+#else
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string();
+#endif
+}
+
+std::string ShellDevToolsManagerDelegate::GetFrontendResource(
+ const std::string& path) {
+ return content::DevToolsFrontendHost::GetFrontendResource(path).as_string();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698