| 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'); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 devtools.InspectorControllerImpl.prototype.evaluateInCallFrame = | 230 devtools.InspectorControllerImpl.prototype.evaluateInCallFrame = |
| 231 function(callFrameId, code, callback) { | 231 function(callFrameId, code, callback) { |
| 232 devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, | 232 devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, |
| 233 callback); | 233 callback); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * @override | 238 * @override |
| 239 */ | 239 */ |
| 240 devtools.InspectorControllerImpl.prototype.getProperties = function( | |
| 241 objectProxy, ignoreHasOwnProperty, callback) { | |
| 242 if (objectProxy.isScope) { | |
| 243 devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, | |
| 244 callback); | |
| 245 } else if (objectProxy.isV8Ref) { | |
| 246 devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, | |
| 247 callback, true); | |
| 248 } else { | |
| 249 this.callInjectedScript_('getProperties', objectProxy, | |
| 250 ignoreHasOwnProperty, callback); | |
| 251 } | |
| 252 }; | |
| 253 | |
| 254 | |
| 255 /** | |
| 256 * @override | |
| 257 */ | |
| 258 devtools.InspectorControllerImpl.prototype.dispatchOnInjectedScript = function( | 240 devtools.InspectorControllerImpl.prototype.dispatchOnInjectedScript = function( |
| 259 callId, methodName, argsString) { | 241 callId, methodName, argsString) { |
| 260 var callback = function(result, isException) { | 242 var callback = function(result, isException) { |
| 261 WebInspector.didDispatchOnInjectedScript(callId, | 243 WebInspector.didDispatchOnInjectedScript(callId, |
| 262 isException ? result : JSON.parse(result), | 244 isException ? result : JSON.parse(result), |
| 263 isException); | 245 isException); |
| 264 }; | 246 }; |
| 265 RemoteToolsAgent.ExecuteUtilityFunction( | 247 RemoteToolsAgent.ExecuteUtilityFunction( |
| 266 devtools.Callback.wrap(callback), | 248 devtools.Callback.wrap(callback), |
| 267 'InjectedScript', | 249 'InjectedScript', |
| 268 JSON.stringify(['dispatch', methodName, argsString])); | 250 JSON.stringify(['dispatch', methodName, argsString])); |
| 269 }; | 251 }; |
| 270 | 252 |
| 271 | 253 |
| 272 /** | 254 /** |
| 273 * This method allows calling a methods on InjectedScript object in the | |
| 274 * inspected page. | |
| 275 */ | |
| 276 devtools.InspectorControllerImpl.prototype.callInjectedScript_ = | |
| 277 function(methodName, var_arg) { | |
| 278 var allArgs = Array.prototype.slice.call(arguments); | |
| 279 var callback = allArgs[allArgs.length - 1]; | |
| 280 var args = Array.prototype.slice.call(allArgs, 0, allArgs.length - 1); | |
| 281 RemoteToolsAgent.ExecuteUtilityFunction( | |
| 282 devtools.InspectorControllerImpl.parseWrap_(callback), | |
| 283 'InjectedScript', JSON.stringify(args)); | |
| 284 }; | |
| 285 | |
| 286 | |
| 287 /** | |
| 288 * Installs delegating handler into the inspector controller. | 255 * Installs delegating handler into the inspector controller. |
| 289 * @param {string} methodName Method to install delegating handler for. | 256 * @param {string} methodName Method to install delegating handler for. |
| 290 */ | 257 */ |
| 291 devtools.InspectorControllerImpl.prototype.installInspectorControllerDelegate_ | 258 devtools.InspectorControllerImpl.prototype.installInspectorControllerDelegate_ |
| 292 = function(methodName) { | 259 = function(methodName) { |
| 293 this[methodName] = goog.bind(this.callInspectorController_, this, | 260 this[methodName] = goog.bind(this.callInspectorController_, this, |
| 294 methodName); | 261 methodName); |
| 295 }; | 262 }; |
| 296 | 263 |
| 297 | 264 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 310 | 277 |
| 311 devtools.InspectorControllerImpl.parseWrap_ = function(callback) { | 278 devtools.InspectorControllerImpl.parseWrap_ = function(callback) { |
| 312 return devtools.Callback.wrap( | 279 return devtools.Callback.wrap( |
| 313 function(data) { | 280 function(data) { |
| 314 callback.call(this, JSON.parse(data)); | 281 callback.call(this, JSON.parse(data)); |
| 315 }); | 282 }); |
| 316 }; | 283 }; |
| 317 | 284 |
| 318 | 285 |
| 319 InspectorController = new devtools.InspectorControllerImpl(); | 286 InspectorController = new devtools.InspectorControllerImpl(); |
| OLD | NEW |