| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.App} | 7 * @extends {WebInspector.App} |
| 8 * @implements {WebInspector.ToolboxHost} | 8 * @implements {WebInspector.ToolboxHost} |
| 9 */ | 9 */ |
| 10 WebInspector.AdvancedApp = function() | 10 WebInspector.AdvancedApp = function() |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 _overridesWarningUpdated: function() | 39 _overridesWarningUpdated: function() |
| 40 { | 40 { |
| 41 if (!this._toggleEmulationButton) | 41 if (!this._toggleEmulationButton) |
| 42 return; | 42 return; |
| 43 var message = WebInspector.overridesSupport.warningMessage(); | 43 var message = WebInspector.overridesSupport.warningMessage(); |
| 44 this._toggleEmulationButton.title = message || WebInspector.UIString("To
ggle device mode."); | 44 this._toggleEmulationButton.title = message || WebInspector.UIString("To
ggle device mode."); |
| 45 this._toggleEmulationButton.element.classList.toggle("warning", !!messag
e); | 45 this._toggleEmulationButton.element.classList.toggle("warning", !!messag
e); |
| 46 }, | 46 }, |
| 47 | 47 |
| 48 presentUI: function() | 48 /** |
| 49 * @param {!Document} document |
| 50 * @override |
| 51 */ |
| 52 presentUI: function(document) |
| 49 { | 53 { |
| 50 var rootView = new WebInspector.RootView(); | 54 var rootView = new WebInspector.RootView(); |
| 51 | 55 |
| 52 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector
View.splitViewState", 300, 300, true); | 56 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector
View.splitViewState", 300, 300, true); |
| 53 this._rootSplitView.show(rootView.element); | 57 this._rootSplitView.show(rootView.element); |
| 54 | 58 |
| 55 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); | 59 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); |
| 56 | 60 |
| 57 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); | 61 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); |
| 58 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this, false), t
his); | 62 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this, false), t
his); |
| 59 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this.
_inspectedPagePlaceholder); | 63 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this.
_inspectedPagePlaceholder); |
| 60 this._responsiveDesignView.show(this._rootSplitView.mainElement()); | 64 this._responsiveDesignView.show(this._rootSplitView.mainElement()); |
| 61 | 65 |
| 62 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); | 66 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); |
| 63 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); | 67 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); |
| 64 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); | 68 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); |
| 65 this._onDockSideChange(); | 69 this._onDockSideChange(); |
| 66 | 70 |
| 67 this._overridesWarningUpdated(); | 71 this._overridesWarningUpdated(); |
| 68 | 72 |
| 69 WebInspector.inspectorView.showInitialPanel(); | 73 WebInspector.inspectorView.showInitialPanel(); |
| 70 console.timeStamp("AdvancedApp.attachToBody"); | 74 console.timeStamp("AdvancedApp.attachToBody"); |
| 71 rootView.attachToBody(); | 75 rootView.attachToDocument(document); |
| 72 this._inspectedPagePlaceholder.update(); | 76 this._inspectedPagePlaceholder.update(); |
| 73 }, | 77 }, |
| 74 | 78 |
| 75 /** | 79 /** |
| 76 * @param {!WebInspector.Event} event | 80 * @param {!WebInspector.Event} event |
| 77 */ | 81 */ |
| 78 _openToolboxWindow: function(event) | 82 _openToolboxWindow: function(event) |
| 79 { | 83 { |
| 80 if (/** @type {string} */ (event.data.to) !== WebInspector.DockControlle
r.State.Undocked) | 84 if (/** @type {string} */ (event.data.to) !== WebInspector.DockControlle
r.State.Undocked) |
| 81 return; | 85 return; |
| 82 | 86 |
| 83 if (this._toolboxWindow) | 87 if (this._toolboxWindow) |
| 84 return; | 88 return; |
| 85 | 89 |
| 86 var url = window.location.href.replace("devtools.html", "toolbox.html"); | 90 var url = window.location.href.replace("devtools.html", "toolbox.html"); |
| 87 this._toolboxWindow = window.open(url, undefined); | 91 this._toolboxWindow = window.open(url, undefined); |
| 88 }, | 92 }, |
| 89 | 93 |
| 90 /** | 94 /** |
| 91 * @param {!Element} rootElement | 95 * @param {!Document} toolboxDocument |
| 92 * @override | 96 * @override |
| 93 */ | 97 */ |
| 94 toolboxLoaded: function(rootElement) | 98 toolboxLoaded: function(toolboxDocument) |
| 95 { | 99 { |
| 100 WebInspector.initializeUIUtils(toolboxDocument.defaultView); |
| 101 WebInspector.installComponentRootStyles(/** @type {!Element} */ (toolbox
Document.body)); |
| 102 WebInspector.ContextMenu.installHandler(toolboxDocument); |
| 103 |
| 104 var rootView = new WebInspector.RootView(); |
| 96 var inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder
(); | 105 var inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder
(); |
| 97 inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePlac
eholder.Events.Update, this._onSetInspectedPageBounds.bind(this, true)); | 106 inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePlac
eholder.Events.Update, this._onSetInspectedPageBounds.bind(this, true)); |
| 98 this._toolboxResponsiveDesignView = new WebInspector.ResponsiveDesignVie
w(inspectedPagePlaceholder); | 107 this._toolboxResponsiveDesignView = new WebInspector.ResponsiveDesignVie
w(inspectedPagePlaceholder); |
| 99 this._toolboxResponsiveDesignView.show(rootElement); | 108 this._toolboxResponsiveDesignView.show(rootView.element); |
| 109 rootView.attachToDocument(toolboxDocument); |
| 110 |
| 100 this._updatePageResizer(); | 111 this._updatePageResizer(); |
| 101 }, | 112 }, |
| 102 | 113 |
| 103 /** | 114 /** |
| 104 * @return {!InspectorFrontendHostAPI} | 115 * @return {!InspectorFrontendHostAPI} |
| 105 */ | 116 */ |
| 106 inspectorFrontendHost: function() | 117 inspectorFrontendHost: function() |
| 107 { | 118 { |
| 108 return window.InspectorFrontendHost; | 119 return window.InspectorFrontendHost; |
| 109 }, | 120 }, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 handleAction: function() | 295 handleAction: function() |
| 285 { | 296 { |
| 286 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) | 297 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) |
| 287 return false; | 298 return false; |
| 288 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 299 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 289 return false; | 300 return false; |
| 290 WebInspector.app._toggleEmulationEnabled(); | 301 WebInspector.app._toggleEmulationEnabled(); |
| 291 return true; | 302 return true; |
| 292 } | 303 } |
| 293 } | 304 } |
| OLD | NEW |