| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 * @param {!WebInspector.InspectedPagePlaceholder} placeholder |
| 99 */ | 100 */ |
| 100 _toolboxLoaded: function(toolbox) | 101 toolboxLoaded: function(responsiveDesignView, placeholder) |
| 101 { | 102 { |
| 102 this._toolbox = toolbox; | 103 this._toolboxResponsiveDesignView = responsiveDesignView; |
| 104 placeholder.addEventListener(WebInspector.InspectedPagePlaceholder.Event
s.Update, this._onSetInspectedPageBounds.bind(this, true)); |
| 103 this._updatePageResizer(); | 105 this._updatePageResizer(); |
| 104 }, | 106 }, |
| 105 | 107 |
| 106 _updatePageResizer: function() | 108 _updatePageResizer: function() |
| 107 { | 109 { |
| 108 if (this._isDocked()) | 110 if (this._isDocked()) |
| 109 this._responsiveDesignView.updatePageResizer(); | 111 this._responsiveDesignView.updatePageResizer(); |
| 110 else if (this._toolbox) | 112 else if (this._toolboxResponsiveDesignView) |
| 111 this._toolbox._responsiveDesignView.updatePageResizer(); | 113 this._toolboxResponsiveDesignView.updatePageResizer(); |
| 112 }, | 114 }, |
| 113 | 115 |
| 114 /** | 116 /** |
| 115 * @param {!WebInspector.Event} event | 117 * @param {!WebInspector.Event} event |
| 116 */ | 118 */ |
| 117 _onBeforeDockSideChange: function(event) | 119 _onBeforeDockSideChange: function(event) |
| 118 { | 120 { |
| 119 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolbox) { | 121 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolboxResponsiveDesignView) { |
| 120 // Hide inspectorView and force layout to mimic the undocked state. | 122 // Hide inspectorView and force layout to mimic the undocked state. |
| 121 this._rootSplitView.hideSidebar(); | 123 this._rootSplitView.hideSidebar(); |
| 122 this._inspectedPagePlaceholder.update(); | 124 this._inspectedPagePlaceholder.update(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 this._changingDockSide = true; | 127 this._changingDockSide = true; |
| 126 }, | 128 }, |
| 127 | 129 |
| 128 /** | 130 /** |
| 129 * @param {!WebInspector.Event=} event | 131 * @param {!WebInspector.Event=} event |
| 130 */ | 132 */ |
| 131 _onDockSideChange: function(event) | 133 _onDockSideChange: function(event) |
| 132 { | 134 { |
| 133 this._updatePageResizer(); | 135 this._updatePageResizer(); |
| 134 | 136 |
| 135 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); | 137 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); |
| 136 if (toDockSide === WebInspector.DockController.State.Undocked) { | 138 if (toDockSide === WebInspector.DockController.State.Undocked) { |
| 137 this._updateForUndocked(); | 139 this._updateForUndocked(); |
| 138 } else if (this._toolbox && event && /** @type {string} */ (event.data.f
rom) === WebInspector.DockController.State.Undocked) { | 140 } else if (this._toolboxResponsiveDesignView && event && /** @type {stri
ng} */ (event.data.from) === WebInspector.DockController.State.Undocked) { |
| 139 // Don't update yet for smooth transition. | 141 // Don't update yet for smooth transition. |
| 140 this._rootSplitView.hideSidebar(); | 142 this._rootSplitView.hideSidebar(); |
| 141 } else { | 143 } else { |
| 142 this._updateForDocked(toDockSide); | 144 this._updateForDocked(toDockSide); |
| 143 } | 145 } |
| 144 }, | 146 }, |
| 145 | 147 |
| 146 /** | 148 /** |
| 147 * @param {!WebInspector.Event} event | 149 * @param {!WebInspector.Event} event |
| 148 */ | 150 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 * @return {?WebInspector.StatusBarItem} | 241 * @return {?WebInspector.StatusBarItem} |
| 240 */ | 242 */ |
| 241 item: function() | 243 item: function() |
| 242 { | 244 { |
| 243 return this._counter; | 245 return this._counter; |
| 244 } | 246 } |
| 245 } | 247 } |
| 246 | 248 |
| 247 /** | 249 /** |
| 248 * @constructor | 250 * @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} | 251 * @implements {WebInspector.StatusBarItem.Provider} |
| 279 */ | 252 */ |
| 280 WebInspector.AdvancedApp.EmulationButtonProvider = function() | 253 WebInspector.AdvancedApp.EmulationButtonProvider = function() |
| 281 { | 254 { |
| 282 } | 255 } |
| 283 | 256 |
| 284 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { | 257 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { |
| 285 /** | 258 /** |
| 286 * @return {?WebInspector.StatusBarItem} | 259 * @return {?WebInspector.StatusBarItem} |
| 287 */ | 260 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 308 handleAction: function() | 281 handleAction: function() |
| 309 { | 282 { |
| 310 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) | 283 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) |
| 311 return false; | 284 return false; |
| 312 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 285 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 313 return false; | 286 return false; |
| 314 WebInspector.app._toggleEmulationEnabled(); | 287 WebInspector.app._toggleEmulationEnabled(); |
| 315 return true; | 288 return true; |
| 316 } | 289 } |
| 317 } | 290 } |
| OLD | NEW |