Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 /** | 5 /** |
| 6 * @fileoverview DevTools' implementation of the InspectorController API. | 6 * @fileoverview DevTools' implementation of the InspectorController API. |
| 7 */ | 7 */ |
| 8 goog.require('devtools.InspectorController'); | 8 goog.require('devtools.InspectorController'); |
| 9 | 9 |
| 10 goog.provide('devtools.InspectorControllerImpl'); | 10 goog.provide('devtools.InspectorControllerImpl'); |
| 11 | 11 |
| 12 devtools.InspectorControllerImpl = function() { | 12 devtools.InspectorControllerImpl = function() { |
| 13 devtools.InspectorController.call(this); | 13 devtools.InspectorController.call(this); |
| 14 this.frame_element_id_ = 1; | 14 this.frame_element_id_ = 1; |
| 15 | 15 |
| 16 this.installInspectorControllerDelegate_('clearMessages'); | 16 this.installInspectorControllerDelegate_('clearMessages'); |
| 17 this.installInspectorControllerDelegate_('storeLastActivePanel'); | 17 this.installInspectorControllerDelegate_('storeLastActivePanel'); |
| 18 this.installInspectorControllerDelegate_('highlightDOMNode'); | 18 this.installInspectorControllerDelegate_('highlightDOMNode'); |
| 19 this.installInspectorControllerDelegate_('hideDOMNodeHighlight'); | 19 this.installInspectorControllerDelegate_('hideDOMNodeHighlight'); |
| 20 this.installInspectorControllerDelegate_('getChildNodes'); | 20 this.installInspectorControllerDelegate_('getChildNodes'); |
| 21 this.installInspectorControllerDelegate_('setAttribute'); | 21 this.installInspectorControllerDelegate_('setAttribute'); |
| 22 this.installInspectorControllerDelegate_('removeAttribute'); | 22 this.installInspectorControllerDelegate_('removeAttribute'); |
| 23 this.installInspectorControllerDelegate_('setTextNodeValue'); | 23 this.installInspectorControllerDelegate_('setTextNodeValue'); |
| 24 this.installInspectorControllerDelegate_('enableResourceTracking'); | 24 this.installInspectorControllerDelegate_('enableResourceTracking'); |
| 25 this.installInspectorControllerDelegate_('disableResourceTracking'); | 25 this.installInspectorControllerDelegate_('disableResourceTracking'); |
| 26 this.installInspectorControllerDelegate_('enableTimeline'); | 26 this.installInspectorControllerDelegate_('enableTimeline'); |
| 27 this.installInspectorControllerDelegate_('disableTimeline'); | 27 this.installInspectorControllerDelegate_('disableTimeline'); |
| 28 | 28 this.installInspectorControllerDelegate_('setting'); |
|
pfeldman
2009/11/18 16:58:19
Hm... How is setting supposed to return the value
| |
| 29 //TODO: nuke with the next WebKit roll. | 29 this.installInspectorControllerDelegate_('setSetting'); |
| 30 this.installInjectedScriptDelegate_('getStyles'); | |
| 31 this.installInjectedScriptDelegate_('getComputedStyle'); | |
| 32 this.installInjectedScriptDelegate_('getInlineStyle'); | |
| 33 this.installInjectedScriptDelegate_('applyStyleText'); | |
| 34 this.installInjectedScriptDelegate_('setStyleText'); | |
| 35 this.installInjectedScriptDelegate_('toggleStyleEnabled'); | |
| 36 this.installInjectedScriptDelegate_('applyStyleRuleText'); | |
| 37 this.installInjectedScriptDelegate_('addStyleSelector'); | |
| 38 this.installInjectedScriptDelegate_('setStyleProperty'); | |
| 39 this.installInjectedScriptDelegate_('getPrototypes'); | |
| 40 this.installInjectedScriptDelegate_('setPropertyValue'); | |
| 41 this.installInjectedScriptDelegate_('evaluate'); | |
| 42 this.installInjectedScriptDelegate_('addInspectedNode'); | |
| 43 this.installInjectedScriptDelegate_('pushNodeToFrontend'); | |
| 44 this.installInjectedScriptDelegate_('performSearch'); | |
| 45 this.installInjectedScriptDelegate_('searchCanceled'); | |
| 46 this.installInjectedScriptDelegate_('openInInspectedWindow'); | |
| 47 }; | 30 }; |
| 48 goog.inherits(devtools.InspectorControllerImpl, | 31 goog.inherits(devtools.InspectorControllerImpl, |
| 49 devtools.InspectorController); | 32 devtools.InspectorController); |
| 50 | 33 |
| 51 | 34 |
| 52 /** | 35 /** |
| 53 * {@inheritDoc}. | 36 * {@inheritDoc}. |
| 54 */ | 37 */ |
| 55 devtools.InspectorControllerImpl.prototype.platform = function() { | 38 devtools.InspectorControllerImpl.prototype.platform = function() { |
| 56 return DevToolsHost.getPlatform(); | 39 return DevToolsHost.getPlatform(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 isException); | 263 isException); |
| 281 }; | 264 }; |
| 282 RemoteToolsAgent.ExecuteUtilityFunction( | 265 RemoteToolsAgent.ExecuteUtilityFunction( |
| 283 devtools.Callback.wrap(callback), | 266 devtools.Callback.wrap(callback), |
| 284 'InjectedScript', | 267 'InjectedScript', |
| 285 JSON.stringify(['dispatch', methodName, argsString])); | 268 JSON.stringify(['dispatch', methodName, argsString])); |
| 286 }; | 269 }; |
| 287 | 270 |
| 288 | 271 |
| 289 /** | 272 /** |
| 290 * TODO: nuke with the next WebKit roll. | 273 * This method allows calling a methods on InjectedScript object in the |
| 291 * Installs delegating handler into the inspector controller. | 274 * inspected page. |
| 292 * @param {string} methodName Method to install delegating handler for. | |
| 293 */ | |
| 294 devtools.InspectorControllerImpl.prototype.installInjectedScriptDelegate_ = | |
| 295 function(methodName) { | |
| 296 this[methodName] = goog.bind(this.callInjectedScript_, this, | |
| 297 methodName); | |
| 298 }; | |
| 299 | |
| 300 | |
| 301 /** | |
| 302 * TODO: nuke with the next WebKit roll. | |
| 303 * Bound function with the installInjectedScriptDelegate_ actual | |
| 304 * implementation. | |
| 305 */ | 275 */ |
| 306 devtools.InspectorControllerImpl.prototype.callInjectedScript_ = | 276 devtools.InspectorControllerImpl.prototype.callInjectedScript_ = |
| 307 function(methodName, var_arg) { | 277 function(methodName, var_arg) { |
| 308 var allArgs = Array.prototype.slice.call(arguments); | 278 var allArgs = Array.prototype.slice.call(arguments); |
| 309 var callback = allArgs[allArgs.length - 1]; | 279 var callback = allArgs[allArgs.length - 1]; |
| 310 var args = Array.prototype.slice.call(allArgs, 0, allArgs.length - 1); | 280 var args = Array.prototype.slice.call(allArgs, 0, allArgs.length - 1); |
| 311 RemoteToolsAgent.ExecuteUtilityFunction( | 281 RemoteToolsAgent.ExecuteUtilityFunction( |
| 312 devtools.InspectorControllerImpl.parseWrap_(callback), | 282 devtools.InspectorControllerImpl.parseWrap_(callback), |
| 313 'InjectedScript', JSON.stringify(args)); | 283 'InjectedScript', JSON.stringify(args)); |
| 314 }; | 284 }; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 340 | 310 |
| 341 devtools.InspectorControllerImpl.parseWrap_ = function(callback) { | 311 devtools.InspectorControllerImpl.parseWrap_ = function(callback) { |
| 342 return devtools.Callback.wrap( | 312 return devtools.Callback.wrap( |
| 343 function(data) { | 313 function(data) { |
| 344 callback.call(this, JSON.parse(data)); | 314 callback.call(this, JSON.parse(data)); |
| 345 }); | 315 }); |
| 346 }; | 316 }; |
| 347 | 317 |
| 348 | 318 |
| 349 InspectorController = new devtools.InspectorControllerImpl(); | 319 InspectorController = new devtools.InspectorControllerImpl(); |
| OLD | NEW |