diff options
author | dgozman@chromium.org <dgozman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 11:38:31 +0000 |
---|---|---|
committer | dgozman@chromium.org <dgozman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 11:38:31 +0000 |
commit | cba37c302cea47ebaf2c20c9e58d9e5189e7c70f (patch) | |
tree | fb23930252450f0d0a03917bb8d3a60e64b07392 | |
parent | f48f81ac2e51a7df5b7bcdf938e33681985163a3 (diff) | |
download | chromium_src-cba37c302cea47ebaf2c20c9e58d9e5189e7c70f.zip chromium_src-cba37c302cea47ebaf2c20c9e58d9e5189e7c70f.tar.gz chromium_src-cba37c302cea47ebaf2c20c9e58d9e5189e7c70f.tar.bz2 |
[DevTools] Move DispatchOnDevToolsFrontend to embedder.
We already have a way to send message via ExecuteJavaScript,
no need for another mechanism.
BUG=398046
TBR=jam
Review URL: https://codereview.chromium.org/418243003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287514 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/devtools/devtools_ui_bindings.cc | 10 | ||||
-rw-r--r-- | content/browser/devtools/devtools_frontend_host_impl.cc | 10 | ||||
-rw-r--r-- | content/browser/devtools/devtools_frontend_host_impl.h | 3 | ||||
-rw-r--r-- | content/public/browser/devtools_frontend_host.h | 5 | ||||
-rw-r--r-- | content/renderer/devtools/devtools_client.cc | 18 | ||||
-rw-r--r-- | content/renderer/devtools/devtools_client.h | 3 | ||||
-rw-r--r-- | content/shell/browser/shell_devtools_frontend.cc | 5 |
7 files changed, 9 insertions, 45 deletions
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index 295a9e2..2274197 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc @@ -412,8 +412,9 @@ void DevToolsUIBindings::HandleMessageFromDevToolsFrontendToBackend( // content::DevToolsClientHost implementation --------------------------------- void DevToolsUIBindings::DispatchOnInspectorFrontend( const std::string& message) { - if (frontend_host_) - frontend_host_->DispatchOnDevToolsFrontend(message); + base::StringValue message_value(message); + CallClientFunction("InspectorFrontendAPI.dispatchMessage", + &message_value, NULL, NULL); } void DevToolsUIBindings::InspectedContentsClosing() { @@ -804,8 +805,9 @@ void DevToolsUIBindings::CallClientFunction(const std::string& function_name, } } } - base::string16 javascript = - base::UTF8ToUTF16(function_name + "(" + params + ");"); + + base::string16 javascript = base::UTF8ToUTF16( + function_name + "(" + params + ");"); web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); } diff --git a/content/browser/devtools/devtools_frontend_host_impl.cc b/content/browser/devtools/devtools_frontend_host_impl.cc index 9a81dfd..a73e88c 100644 --- a/content/browser/devtools/devtools_frontend_host_impl.cc +++ b/content/browser/devtools/devtools_frontend_host_impl.cc @@ -30,16 +30,6 @@ DevToolsFrontendHostImpl::DevToolsFrontendHostImpl( DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() { } -void DevToolsFrontendHostImpl::DispatchOnDevToolsFrontend( - const std::string& message) { - if (!web_contents()) - return; - RenderViewHost* target_host = web_contents()->GetRenderViewHost(); - target_host->Send(new DevToolsClientMsg_DispatchOnInspectorFrontend( - target_host->GetRoutingID(), - message)); -} - bool DevToolsFrontendHostImpl::OnMessageReceived( const IPC::Message& message) { bool handled = true; diff --git a/content/browser/devtools/devtools_frontend_host_impl.h b/content/browser/devtools/devtools_frontend_host_impl.h index b6bb79b..4d6a3e2 100644 --- a/content/browser/devtools/devtools_frontend_host_impl.h +++ b/content/browser/devtools/devtools_frontend_host_impl.h @@ -17,9 +17,6 @@ class DevToolsFrontendHostImpl : public DevToolsFrontendHost, DevToolsFrontendHost::Delegate* delegate); virtual ~DevToolsFrontendHostImpl(); - // DevToolsFrontendHost implementation. - virtual void DispatchOnDevToolsFrontend(const std::string& message) OVERRIDE; - private: // WebContentsObserver overrides. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; diff --git a/content/public/browser/devtools_frontend_host.h b/content/public/browser/devtools_frontend_host.h index ac79df2..24c50f5 100644 --- a/content/public/browser/devtools_frontend_host.h +++ b/content/public/browser/devtools_frontend_host.h @@ -41,11 +41,6 @@ class DevToolsFrontendHost { RenderViewHost* frontend_rvh, Delegate* delegate); CONTENT_EXPORT virtual ~DevToolsFrontendHost() {} - - // Dispatches message from embedder/backend to frontend. - // TODO(dgozman): remove and make embedder to take care of this. - CONTENT_EXPORT virtual void DispatchOnDevToolsFrontend( - const std::string& message) = 0; }; } // namespace content diff --git a/content/renderer/devtools/devtools_client.cc b/content/renderer/devtools/devtools_client.cc index 5799fa4..0d4f7dc 100644 --- a/content/renderer/devtools/devtools_client.cc +++ b/content/renderer/devtools/devtools_client.cc @@ -36,19 +36,6 @@ DevToolsClient::DevToolsClient(RenderViewImpl* render_view) DevToolsClient::~DevToolsClient() { } -bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { - DCHECK(RenderThreadImpl::current()); - - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) - IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, - OnDispatchOnInspectorFrontend) - IPC_MESSAGE_UNHANDLED(handled = false); - IPC_END_MESSAGE_MAP() - - return handled; -} - void DevToolsClient::sendMessageToBackend(const WebString& message) { Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(), message.utf8())); @@ -63,9 +50,4 @@ bool DevToolsClient::isUnderTest() { return RenderThreadImpl::current()->layout_test_mode(); } -void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { - web_tools_frontend_->dispatchOnInspectorFrontend( - WebString::fromUTF8(message)); -} - } // namespace content diff --git a/content/renderer/devtools/devtools_client.h b/content/renderer/devtools/devtools_client.h index be1e902..0c08324 100644 --- a/content/renderer/devtools/devtools_client.h +++ b/content/renderer/devtools/devtools_client.h @@ -35,9 +35,6 @@ class CONTENT_EXPORT DevToolsClient virtual ~DevToolsClient(); private: - // RenderView::Observer implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - // WebDevToolsFrontendClient implementation. virtual void sendMessageToBackend(const blink::WebString&) OVERRIDE; virtual void sendMessageToEmbedder(const blink::WebString&) OVERRIDE; diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc index 76e2936..2b11e8e 100644 --- a/content/shell/browser/shell_devtools_frontend.cc +++ b/content/shell/browser/shell_devtools_frontend.cc @@ -179,8 +179,9 @@ void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( void ShellDevToolsFrontend::DispatchOnInspectorFrontend( const std::string& message) { - if (frontend_host_) - frontend_host_->DispatchOnDevToolsFrontend(message); + std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");"; + base::string16 javascript = base::UTF8ToUTF16(code); + web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); } void ShellDevToolsFrontend::InspectedContentsClosing() { |