| 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 Tools is a main class that wires all components of the | 6 * @fileoverview Tools is a main class that wires all components of the |
| 7 * DevTools frontend together. It is also responsible for overriding existing | 7 * DevTools frontend together. It is also responsible for overriding existing |
| 8 * WebInspector functionality while it is getting upstreamed into WebCore. | 8 * WebInspector functionality while it is getting upstreamed into WebCore. |
| 9 */ | 9 */ |
| 10 goog.provide('devtools.Tools'); | 10 goog.provide('devtools.Tools'); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 | 36 |
| 37 devtools.ToolsAgent = function() { | 37 devtools.ToolsAgent = function() { |
| 38 RemoteToolsAgent.DidDispatchOn = | 38 RemoteToolsAgent.DidDispatchOn = |
| 39 WebInspector.Callback.processCallback; | 39 WebInspector.Callback.processCallback; |
| 40 RemoteToolsAgent.FrameNavigate = | 40 RemoteToolsAgent.FrameNavigate = |
| 41 goog.bind(this.frameNavigate_, this); | 41 goog.bind(this.frameNavigate_, this); |
| 42 RemoteToolsAgent.DispatchOnClient = | 42 RemoteToolsAgent.DispatchOnClient = |
| 43 goog.bind(this.dispatchOnClient_, this); | 43 goog.bind(this.dispatchOnClient_, this); |
| 44 this.debuggerAgent_ = new devtools.DebuggerAgent(); | 44 this.debuggerAgent_ = new devtools.DebuggerAgent(); |
| 45 this.profilerAgent_ = new devtools.ProfilerAgent(); | |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 | 47 |
| 49 /** | 48 /** |
| 50 * Resets tools agent to its initial state. | 49 * Resets tools agent to its initial state. |
| 51 */ | 50 */ |
| 52 devtools.ToolsAgent.prototype.reset = function() { | 51 devtools.ToolsAgent.prototype.reset = function() { |
| 53 InspectorFrontendHost.reset(); | 52 InspectorFrontendHost.reset(); |
| 54 this.debuggerAgent_.reset(); | 53 this.debuggerAgent_.reset(); |
| 55 this.profilerAgent_.reset(); | |
| 56 }; | 54 }; |
| 57 | 55 |
| 58 | 56 |
| 59 /** | 57 /** |
| 60 * @param {string} script Script exression to be evaluated in the context of the | 58 * @param {string} script Script exression to be evaluated in the context of the |
| 61 * inspected page. | 59 * inspected page. |
| 62 * @param {function(Object|string, boolean):undefined} opt_callback Function to | 60 * @param {function(Object|string, boolean):undefined} opt_callback Function to |
| 63 * call with the result. | 61 * call with the result. |
| 64 */ | 62 */ |
| 65 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, | 63 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, |
| 66 opt_callback) { | 64 opt_callback) { |
| 67 InspectorBackend.evaluate(script, opt_callback || function() {}); | 65 InspectorBackend.evaluate(script, opt_callback || function() {}); |
| 68 }; | 66 }; |
| 69 | 67 |
| 70 | 68 |
| 71 /** | 69 /** |
| 72 * @return {devtools.DebuggerAgent} Debugger agent instance. | 70 * @return {devtools.DebuggerAgent} Debugger agent instance. |
| 73 */ | 71 */ |
| 74 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { | 72 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { |
| 75 return this.debuggerAgent_; | 73 return this.debuggerAgent_; |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 | 76 |
| 79 /** | 77 /** |
| 80 * @return {devtools.ProfilerAgent} Profiler agent instance. | |
| 81 */ | |
| 82 devtools.ToolsAgent.prototype.getProfilerAgent = function() { | |
| 83 return this.profilerAgent_; | |
| 84 }; | |
| 85 | |
| 86 | |
| 87 /** | |
| 88 * @param {string} url Url frame navigated to. | 78 * @param {string} url Url frame navigated to. |
| 89 * @see tools_agent.h | 79 * @see tools_agent.h |
| 90 * @private | 80 * @private |
| 91 */ | 81 */ |
| 92 devtools.ToolsAgent.prototype.frameNavigate_ = function(url) { | 82 devtools.ToolsAgent.prototype.frameNavigate_ = function(url) { |
| 93 this.reset(); | 83 this.reset(); |
| 94 // Do not reset Profiles panel. | 84 // Do not reset Profiles panel. |
| 95 var profiles = null; | 85 var profiles = null; |
| 96 if ('profiles' in WebInspector.panels) { | 86 if ('profiles' in WebInspector.panels) { |
| 97 profiles = WebInspector.panels['profiles']; | 87 profiles = WebInspector.panels['profiles']; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 devtools.tools.getDebuggerAgent().initUI(); | 312 devtools.tools.getDebuggerAgent().initUI(); |
| 323 this.enableToggleButton.visible = false; | 313 this.enableToggleButton.visible = false; |
| 324 oldShow.call(this); | 314 oldShow.call(this); |
| 325 }; | 315 }; |
| 326 })(); | 316 })(); |
| 327 | 317 |
| 328 | 318 |
| 329 (function InterceptProfilesPanelEvents() { | 319 (function InterceptProfilesPanelEvents() { |
| 330 var oldShow = WebInspector.ProfilesPanel.prototype.show; | 320 var oldShow = WebInspector.ProfilesPanel.prototype.show; |
| 331 WebInspector.ProfilesPanel.prototype.show = function() { | 321 WebInspector.ProfilesPanel.prototype.show = function() { |
| 332 devtools.tools.getProfilerAgent().initializeProfiling(); | 322 devtools.tools.getDebuggerAgent().initializeProfiling(); |
| 333 this.enableToggleButton.visible = false; | 323 this.enableToggleButton.visible = false; |
| 334 oldShow.call(this); | 324 oldShow.call(this); |
| 335 // Show is called on every show event of a panel, so | 325 // Show is called on every show event of a panel, so |
| 336 // we only need to intercept it once. | 326 // we only need to intercept it once. |
| 337 WebInspector.ProfilesPanel.prototype.show = oldShow; | 327 WebInspector.ProfilesPanel.prototype.show = oldShow; |
| 338 }; | 328 }; |
| 339 })(); | 329 })(); |
| 340 | 330 |
| 341 | 331 |
| 342 /* | 332 /* |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 (function() { | 476 (function() { |
| 487 var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; | 477 var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; |
| 488 InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) { | 478 InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) { |
| 489 var resource = WebInspector.resources[identifier]; | 479 var resource = WebInspector.resources[identifier]; |
| 490 if (!resource) { | 480 if (!resource) { |
| 491 return; | 481 return; |
| 492 } | 482 } |
| 493 originalAddToFrame.call(this, identifier, resource.mimeType, element); | 483 originalAddToFrame.call(this, identifier, resource.mimeType, element); |
| 494 }; | 484 }; |
| 495 })(); | 485 })(); |
| OLD | NEW |