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

Unified Diff: Source/web/InspectorFrontendClientImpl.cpp

Issue 23289002: Introduce InspectorFrontendHost.sendMessageToFrontendHost. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 4 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
« no previous file with comments | « Source/web/InspectorFrontendClientImpl.h ('k') | public/web/WebDevToolsFrontendClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/InspectorFrontendClientImpl.cpp
diff --git a/Source/web/InspectorFrontendClientImpl.cpp b/Source/web/InspectorFrontendClientImpl.cpp
index c5ebdab8cd9228fbc98b564c8ff0f7f484c8d0a6..60e1eb24f53ee1bd4e6025f7e9c6170125b5b02e 100644
--- a/Source/web/InspectorFrontendClientImpl.cpp
+++ b/Source/web/InspectorFrontendClientImpl.cpp
@@ -74,6 +74,39 @@ void InspectorFrontendClientImpl::windowObjectCleared()
v8::Handle<v8::Object> global = frameContext->Global();
global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj);
+
+ ScriptController* scriptController = m_frontendPage->mainFrame() ? m_frontendPage->mainFrame()->script() : 0;
+ if (scriptController) {
+ String installLegacyOverrides =
+ "(function(host, legacyMethodNames) {"
+ " function dispatch(methodName, oldImpl) {"
+ " var argsArray = Array.prototype.slice.call(arguments, 2);"
+ " var message = {'method': methodName};"
+ " if (argsArray.length)"
+ " message.params = argsArray;"
+ " this.sendMessageToEmbedder(JSON.stringify(message));"
+ " if (oldImpl)"
+ " oldImpl.apply(this, argsArray);"
+ " };"
+ " legacyMethodNames.forEach(function(methodName) {"
+ " host[methodName] = dispatch.bind(host, methodName, host[methodName]);"
+ " });"
+ "})(InspectorFrontendHost,"
+ " ['moveWindowBy',"
+ " 'bringToFront',"
+ " 'requestSetDockSide',"
+ " 'openInNewTab',"
+ " 'save',"
+ " 'append',"
+ " 'requestFileSystems',"
+ " 'indexPath',"
+ " 'stopIndexing',"
+ " 'searchInPath',"
+ " 'addFileSystem',"
+ " 'removeFileSystem']);";
+
+ scriptController->executeScriptInMainWorld(ScriptSourceCode(installLegacyOverrides));
+ }
}
void InspectorFrontendClientImpl::moveWindowBy(float x, float y)
@@ -132,6 +165,11 @@ void InspectorFrontendClientImpl::sendMessageToBackend(const String& message)
m_client->sendMessageToBackend(message);
}
+void InspectorFrontendClientImpl::sendMessageToEmbedder(const String& message)
+{
+ m_client->sendMessageToEmbedder(message);
+}
+
void InspectorFrontendClientImpl::requestFileSystems()
{
m_client->requestFileSystems();
« no previous file with comments | « Source/web/InspectorFrontendClientImpl.h ('k') | public/web/WebDevToolsFrontendClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698