| 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 */ | 8 */ |
| 9 WebInspector.AdvancedApp = function() | 9 WebInspector.AdvancedApp = function() |
| 10 { | 10 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 createRootView: function() | 47 createRootView: function() |
| 48 { | 48 { |
| 49 var rootView = new WebInspector.RootView(); | 49 var rootView = new WebInspector.RootView(); |
| 50 | 50 |
| 51 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector
View.splitViewState", 300, 300, true); | 51 this._rootSplitView = new WebInspector.SplitView(false, true, "Inspector
View.splitViewState", 300, 300, true); |
| 52 this._rootSplitView.show(rootView.element); | 52 this._rootSplitView.show(rootView.element); |
| 53 | 53 |
| 54 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); | 54 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); |
| 55 | 55 |
| 56 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); | 56 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); |
| 57 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this, false), t
his); | 57 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this.onSetInspectedPageBounds.bind(this, false), th
is); |
| 58 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this.
_inspectedPagePlaceholder); | 58 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this.
_inspectedPagePlaceholder); |
| 59 this._responsiveDesignView.show(this._rootSplitView.mainElement()); | 59 this._responsiveDesignView.show(this._rootSplitView.mainElement()); |
| 60 | 60 |
| 61 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); | 61 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); |
| 62 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); | 62 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); |
| 63 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); | 63 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); |
| 64 this._onDockSideChange(); | 64 this._onDockSideChange(); |
| 65 | 65 |
| 66 console.timeStamp("AdvancedApp.attachToBody"); | 66 console.timeStamp("AdvancedApp.attachToBody"); |
| 67 rootView.attachToBody(); | 67 rootView.attachToBody(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 if (this._toolboxWindow) | 88 if (this._toolboxWindow) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 var toolbox = (window.location.search ? "&" : "?") + "toolbox=true"; | 91 var toolbox = (window.location.search ? "&" : "?") + "toolbox=true"; |
| 92 var hash = window.location.hash; | 92 var hash = window.location.hash; |
| 93 var url = window.location.href.replace(hash, "") + toolbox + hash; | 93 var url = window.location.href.replace(hash, "") + toolbox + hash; |
| 94 this._toolboxWindow = window.open(url, undefined); | 94 this._toolboxWindow = window.open(url, undefined); |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * @param {!WebInspector.Toolbox} toolbox | 98 * @param {!WebInspector.ResponsiveDesignView} responsiveDesignView |
| 99 */ | 99 */ |
| 100 _toolboxLoaded: function(toolbox) | 100 toolboxLoaded: function(responsiveDesignView) |
| 101 { | 101 { |
| 102 this._toolbox = toolbox; | 102 this._toolboxResponsiveDesignView = responsiveDesignView; |
| 103 this._updatePageResizer(); | 103 this._updatePageResizer(); |
| 104 }, | 104 }, |
| 105 | 105 |
| 106 _updatePageResizer: function() | 106 _updatePageResizer: function() |
| 107 { | 107 { |
| 108 if (this._isDocked()) | 108 if (this._isDocked()) |
| 109 this._responsiveDesignView.updatePageResizer(); | 109 this._responsiveDesignView.updatePageResizer(); |
| 110 else if (this._toolbox) | 110 else if (this._toolboxResponsiveDesignView) |
| 111 this._toolbox._responsiveDesignView.updatePageResizer(); | 111 this._toolboxResponsiveDesignView.updatePageResizer(); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * @param {!WebInspector.Event} event | 115 * @param {!WebInspector.Event} event |
| 116 */ | 116 */ |
| 117 _onBeforeDockSideChange: function(event) | 117 _onBeforeDockSideChange: function(event) |
| 118 { | 118 { |
| 119 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolbox) { | 119 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolboxResponsiveDesignView) { |
| 120 // Hide inspectorView and force layout to mimic the undocked state. | 120 // Hide inspectorView and force layout to mimic the undocked state. |
| 121 this._rootSplitView.hideSidebar(); | 121 this._rootSplitView.hideSidebar(); |
| 122 this._inspectedPagePlaceholder.update(); | 122 this._inspectedPagePlaceholder.update(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 this._changingDockSide = true; | 125 this._changingDockSide = true; |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * @param {!WebInspector.Event=} event | 129 * @param {!WebInspector.Event=} event |
| 130 */ | 130 */ |
| 131 _onDockSideChange: function(event) | 131 _onDockSideChange: function(event) |
| 132 { | 132 { |
| 133 this._updatePageResizer(); | 133 this._updatePageResizer(); |
| 134 | 134 |
| 135 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); | 135 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); |
| 136 if (toDockSide === WebInspector.DockController.State.Undocked) { | 136 if (toDockSide === WebInspector.DockController.State.Undocked) { |
| 137 this._updateForUndocked(); | 137 this._updateForUndocked(); |
| 138 } else if (this._toolbox && event && /** @type {string} */ (event.data.f
rom) === WebInspector.DockController.State.Undocked) { | 138 } else if (this._toolboxResponsiveDesignView && event && /** @type {stri
ng} */ (event.data.from) === WebInspector.DockController.State.Undocked) { |
| 139 // Don't update yet for smooth transition. | 139 // Don't update yet for smooth transition. |
| 140 this._rootSplitView.hideSidebar(); | 140 this._rootSplitView.hideSidebar(); |
| 141 } else { | 141 } else { |
| 142 this._updateForDocked(toDockSide); | 142 this._updateForDocked(toDockSide); |
| 143 } | 143 } |
| 144 }, | 144 }, |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {!WebInspector.Event} event | 147 * @param {!WebInspector.Event} event |
| 148 */ | 148 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 _isDocked: function() | 181 _isDocked: function() |
| 182 { | 182 { |
| 183 return WebInspector.dockController.dockSide() !== WebInspector.DockContr
oller.State.Undocked; | 183 return WebInspector.dockController.dockSide() !== WebInspector.DockContr
oller.State.Undocked; |
| 184 }, | 184 }, |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * @param {boolean} toolbox | 187 * @param {boolean} toolbox |
| 188 * @param {!WebInspector.Event} event | 188 * @param {!WebInspector.Event} event |
| 189 */ | 189 */ |
| 190 _onSetInspectedPageBounds: function(toolbox, event) | 190 onSetInspectedPageBounds: function(toolbox, event) |
| 191 { | 191 { |
| 192 if (this._changingDockSide || (this._isDocked() === toolbox)) | 192 if (this._changingDockSide || (this._isDocked() === toolbox)) |
| 193 return; | 193 return; |
| 194 if (!window.innerWidth || !window.innerHeight) | 194 if (!window.innerWidth || !window.innerHeight) |
| 195 return; | 195 return; |
| 196 var bounds = /** @type {{x: number, y: number, width: number, height: nu
mber}} */ (event.data); | 196 var bounds = /** @type {{x: number, y: number, width: number, height: nu
mber}} */ (event.data); |
| 197 console.timeStamp("AdvancedApp.setInspectedPageBounds"); | 197 console.timeStamp("AdvancedApp.setInspectedPageBounds"); |
| 198 InspectorFrontendHost.setInspectedPageBounds(bounds); | 198 InspectorFrontendHost.setInspectedPageBounds(bounds); |
| 199 }, | 199 }, |
| 200 | 200 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 * @return {?WebInspector.StatusBarItem} | 239 * @return {?WebInspector.StatusBarItem} |
| 240 */ | 240 */ |
| 241 item: function() | 241 item: function() |
| 242 { | 242 { |
| 243 return this._counter; | 243 return this._counter; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 /** | 247 /** |
| 248 * @constructor | 248 * @constructor |
| 249 */ | |
| 250 WebInspector.Toolbox = function() | |
| 251 { | |
| 252 if (!window.opener) | |
| 253 return; | |
| 254 | |
| 255 WebInspector.zoomManager = new WebInspector.ZoomManager(window.opener.Inspec
torFrontendHost); | |
| 256 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; | |
| 257 WebInspector.settings = window.opener.WebInspector.settings; | |
| 258 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet
tings; | |
| 259 WebInspector.targetManager = window.opener.WebInspector.targetManager; | |
| 260 WebInspector.workspace = window.opener.WebInspector.workspace; | |
| 261 WebInspector.cssWorkspaceBinding = window.opener.WebInspector.cssWorkspaceBi
nding; | |
| 262 WebInspector.Revealer = window.opener.WebInspector.Revealer; | |
| 263 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu; | |
| 264 WebInspector.installPortStyles(); | |
| 265 | |
| 266 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We
bInspector.app); | |
| 267 var rootView = new WebInspector.RootView(); | |
| 268 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder()
; | |
| 269 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl
aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp,
true)); | |
| 270 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins
pectedPagePlaceholder); | |
| 271 this._responsiveDesignView.show(rootView.element); | |
| 272 rootView.attachToBody(); | |
| 273 advancedApp._toolboxLoaded(this); | |
| 274 } | |
| 275 | |
| 276 /** | |
| 277 * @constructor | |
| 278 * @implements {WebInspector.StatusBarItem.Provider} | 249 * @implements {WebInspector.StatusBarItem.Provider} |
| 279 */ | 250 */ |
| 280 WebInspector.AdvancedApp.EmulationButtonProvider = function() | 251 WebInspector.AdvancedApp.EmulationButtonProvider = function() |
| 281 { | 252 { |
| 282 } | 253 } |
| 283 | 254 |
| 284 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { | 255 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { |
| 285 /** | 256 /** |
| 286 * @return {?WebInspector.StatusBarItem} | 257 * @return {?WebInspector.StatusBarItem} |
| 287 */ | 258 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 308 handleAction: function() | 279 handleAction: function() |
| 309 { | 280 { |
| 310 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) | 281 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) |
| 311 return false; | 282 return false; |
| 312 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 283 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 313 return false; | 284 return false; |
| 314 WebInspector.app._toggleEmulationEnabled(); | 285 WebInspector.app._toggleEmulationEnabled(); |
| 315 return true; | 286 return true; |
| 316 } | 287 } |
| 317 } | 288 } |
| OLD | NEW |