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

Side by Side Diff: Source/web/InspectorFrontendClientImpl.cpp

Issue 23290002: Complete migration to InspectorFrontendHost.sendMessageToFrontendHost. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/InspectorFrontendClientImpl.h ('k') | public/web/WebDevToolsFrontendClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 m_frontendHost = InspectorFrontendHost::create(this, m_frontendPage); 72 m_frontendHost = InspectorFrontendHost::create(this, m_frontendPage);
73 v8::Handle<v8::Value> frontendHostObj = toV8(m_frontendHost.get(), v8::Handl e<v8::Object>(), frameContext->GetIsolate()); 73 v8::Handle<v8::Value> frontendHostObj = toV8(m_frontendHost.get(), v8::Handl e<v8::Object>(), frameContext->GetIsolate());
74 v8::Handle<v8::Object> global = frameContext->Global(); 74 v8::Handle<v8::Object> global = frameContext->Global();
75 75
76 global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj); 76 global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj);
77 77
78 ScriptController* scriptController = m_frontendPage->mainFrame() ? m_fronten dPage->mainFrame()->script() : 0; 78 ScriptController* scriptController = m_frontendPage->mainFrame() ? m_fronten dPage->mainFrame()->script() : 0;
79 if (scriptController) { 79 if (scriptController) {
80 String installLegacyOverrides = 80 String installLegacyOverrides =
81 "(function(host, legacyMethodNames) {" 81 "(function(host, legacyMethodNames) {"
82 " function dispatch(methodName, oldImpl) {" 82 " function dispatch(methodName) {"
83 " var argsArray = Array.prototype.slice.call(arguments, 2);" 83 " var argsArray = Array.prototype.slice.call(arguments, 1);"
84 " var message = {'method': methodName};" 84 " var message = {'method': methodName};"
85 " if (argsArray.length)" 85 " if (argsArray.length)"
86 " message.params = argsArray;" 86 " message.params = argsArray;"
87 " this.sendMessageToEmbedder(JSON.stringify(message));" 87 " this.sendMessageToEmbedder(JSON.stringify(message));"
88 " if (oldImpl)"
89 " oldImpl.apply(this, argsArray);"
90 " };" 88 " };"
91 " legacyMethodNames.forEach(function(methodName) {" 89 " legacyMethodNames.forEach(function(methodName) {"
92 " host[methodName] = dispatch.bind(host, methodName, host[met hodName]);" 90 " host[methodName] = dispatch.bind(host, methodName);"
93 " });" 91 " });"
94 "})(InspectorFrontendHost," 92 "})(InspectorFrontendHost,"
95 " ['moveWindowBy'," 93 " ['moveWindowBy',"
96 " 'bringToFront'," 94 " 'bringToFront',"
97 " 'requestSetDockSide'," 95 " 'requestSetDockSide',"
98 " 'openInNewTab'," 96 " 'openInNewTab',"
99 " 'save'," 97 " 'save',"
100 " 'append'," 98 " 'append',"
101 " 'requestFileSystems'," 99 " 'requestFileSystems',"
102 " 'indexPath'," 100 " 'indexPath',"
103 " 'stopIndexing'," 101 " 'stopIndexing',"
104 " 'searchInPath'," 102 " 'searchInPath',"
105 " 'addFileSystem'," 103 " 'addFileSystem',"
106 " 'removeFileSystem']);"; 104 " 'removeFileSystem']);";
107 105
108 scriptController->executeScriptInMainWorld(ScriptSourceCode(installLegac yOverrides)); 106 scriptController->executeScriptInMainWorld(ScriptSourceCode(installLegac yOverrides));
109 } 107 }
110 } 108 }
111 109
112 void InspectorFrontendClientImpl::moveWindowBy(float x, float y)
113 {
114 m_client->moveWindowBy(WebFloatPoint(x, y));
115 }
116
117 void InspectorFrontendClientImpl::bringToFront()
118 {
119 m_client->activateWindow();
120 }
121
122 void InspectorFrontendClientImpl::closeWindow()
123 {
124 m_client->closeWindow();
125 }
126
127 void InspectorFrontendClientImpl::requestSetDockSide(DockSide side)
128 {
129 String sideString = "undocked";
130 switch (side) {
131 case DockedToRight: sideString = "right"; break;
132 case DockedToBottom: sideString = "bottom"; break;
133 case Undocked: sideString = "undocked"; break;
134 }
135 m_client->requestSetDockSide(sideString);
136 }
137
138 void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned height)
139 {
140 m_client->changeAttachedWindowHeight(height);
141 }
142
143 void InspectorFrontendClientImpl::openInNewTab(const String& url)
144 {
145 m_client->openInNewTab(url);
146 }
147
148 void InspectorFrontendClientImpl::save(const String& url, const String& content, bool forceSaveAs)
149 {
150 m_client->save(url, content, forceSaveAs);
151 }
152
153 void InspectorFrontendClientImpl::append(const String& url, const String& conten t)
154 {
155 m_client->append(url, content);
156 }
157
158 void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) 110 void InspectorFrontendClientImpl::inspectedURLChanged(const String& url)
159 { 111 {
160 m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url ); 112 m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url );
161 } 113 }
162 114
163 void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) 115 void InspectorFrontendClientImpl::sendMessageToBackend(const String& message)
164 { 116 {
165 m_client->sendMessageToBackend(message); 117 m_client->sendMessageToBackend(message);
166 } 118 }
167 119
168 void InspectorFrontendClientImpl::sendMessageToEmbedder(const String& message) 120 void InspectorFrontendClientImpl::sendMessageToEmbedder(const String& message)
169 { 121 {
170 m_client->sendMessageToEmbedder(message); 122 m_client->sendMessageToEmbedder(message);
171 } 123 }
172 124
173 void InspectorFrontendClientImpl::requestFileSystems()
174 {
175 m_client->requestFileSystems();
176 }
177
178 void InspectorFrontendClientImpl::indexPath(int requestId, const String& fileSys temPath)
179 {
180 m_client->indexPath(requestId, fileSystemPath);
181 }
182
183 void InspectorFrontendClientImpl::stopIndexing(int requestId)
184 {
185 m_client->stopIndexing(requestId);
186 }
187
188 void InspectorFrontendClientImpl::searchInPath(int requestId, const String& file SystemPath, const String& query)
189 {
190 m_client->searchInPath(requestId, fileSystemPath, query);
191 }
192
193 void InspectorFrontendClientImpl::addFileSystem()
194 {
195 m_client->addFileSystem();
196 }
197
198 void InspectorFrontendClientImpl::removeFileSystem(const String& fileSystemPath)
199 {
200 m_client->removeFileSystem(fileSystemPath);
201 }
202
203 bool InspectorFrontendClientImpl::isUnderTest() 125 bool InspectorFrontendClientImpl::isUnderTest()
204 { 126 {
205 return m_client->isUnderTest(); 127 return m_client->isUnderTest();
206 } 128 }
207 129
208 } // namespace WebKit 130 } // namespace WebKit
OLDNEW
« 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