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 * @implements {WebInspector.App} | 7 * @implements {WebInspector.App} |
8 */ | 8 */ |
9 WebInspector.AdvancedApp = function() | 9 WebInspector.AdvancedApp = function() |
10 { | 10 { |
(...skipping 10 matching lines...) Expand all Loading... |
21 { | 21 { |
22 var rootView = new WebInspector.RootView(); | 22 var rootView = new WebInspector.RootView(); |
23 | 23 |
24 this._rootSplitWidget = new WebInspector.SplitWidget(false, true, "Inspe
ctorView.splitViewState", 555, 300, true); | 24 this._rootSplitWidget = new WebInspector.SplitWidget(false, true, "Inspe
ctorView.splitViewState", 555, 300, true); |
25 this._rootSplitWidget.show(rootView.element); | 25 this._rootSplitWidget.show(rootView.element); |
26 | 26 |
27 this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView); | 27 this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView); |
28 | 28 |
29 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); | 29 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold
er(); |
30 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this), this); | 30 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPa
gePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this), this); |
31 if (Runtime.experiments.isEnabled("deviceMode")) | 31 this._deviceModeView = new WebInspector.DeviceModeView.Wrapper(this._ins
pectedPagePlaceholder); |
32 this._responsiveDesignView = new WebInspector.DeviceModeView.Wrapper
(this._inspectedPagePlaceholder); | |
33 else | |
34 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(t
his._inspectedPagePlaceholder); | |
35 | 32 |
36 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); | 33 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.BeforeDockSideChanged, this._onBeforeDockSideChange, this); |
37 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); | 34 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.DockSideChanged, this._onDockSideChange, this); |
38 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); | 35 WebInspector.dockController.addEventListener(WebInspector.DockController
.Events.AfterDockSideChanged, this._onAfterDockSideChange, this); |
39 this._onDockSideChange(); | 36 this._onDockSideChange(); |
40 | 37 |
41 WebInspector.inspectorView.showInitialPanel(); | 38 WebInspector.inspectorView.showInitialPanel(); |
42 console.timeStamp("AdvancedApp.attachToBody"); | 39 console.timeStamp("AdvancedApp.attachToBody"); |
43 rootView.attachToDocument(document); | 40 rootView.attachToDocument(document); |
44 this._inspectedPagePlaceholder.update(); | 41 this._inspectedPagePlaceholder.update(); |
(...skipping 25 matching lines...) Expand all Loading... |
70 toolboxLoaded: function(toolboxDocument) | 67 toolboxLoaded: function(toolboxDocument) |
71 { | 68 { |
72 WebInspector.initializeUIUtils(toolboxDocument, WebInspector.settings.cr
eateSetting("uiTheme", "default")); | 69 WebInspector.initializeUIUtils(toolboxDocument, WebInspector.settings.cr
eateSetting("uiTheme", "default")); |
73 WebInspector.installComponentRootStyles(/** @type {!Element} */ (toolbox
Document.body)); | 70 WebInspector.installComponentRootStyles(/** @type {!Element} */ (toolbox
Document.body)); |
74 WebInspector.ContextMenu.installHandler(toolboxDocument); | 71 WebInspector.ContextMenu.installHandler(toolboxDocument); |
75 WebInspector.Tooltip.installHandler(toolboxDocument); | 72 WebInspector.Tooltip.installHandler(toolboxDocument); |
76 | 73 |
77 this._toolboxRootView = new WebInspector.RootView(); | 74 this._toolboxRootView = new WebInspector.RootView(); |
78 this._toolboxRootView.attachToDocument(toolboxDocument); | 75 this._toolboxRootView.attachToDocument(toolboxDocument); |
79 | 76 |
80 this._updateResponsiveDesignView(); | 77 this._updateDeviceModeView(); |
81 | 78 |
82 if (this._presentUICallback) { | 79 if (this._presentUICallback) { |
83 var callback = this._presentUICallback; | 80 var callback = this._presentUICallback; |
84 delete this._presentUICallback; | 81 delete this._presentUICallback; |
85 callback(); | 82 callback(); |
86 } | 83 } |
87 }, | 84 }, |
88 | 85 |
89 _updateResponsiveDesignView: function() | 86 _updateDeviceModeView: function() |
90 { | 87 { |
91 if (this._isDocked()) | 88 if (this._isDocked()) |
92 this._rootSplitWidget.setMainWidget(this._responsiveDesignView); | 89 this._rootSplitWidget.setMainWidget(this._deviceModeView); |
93 else if (this._toolboxRootView) | 90 else if (this._toolboxRootView) |
94 this._responsiveDesignView.show(this._toolboxRootView.element); | 91 this._deviceModeView.show(this._toolboxRootView.element); |
95 if (!Runtime.experiments.isEnabled("deviceMode") && (this._isDocked() ||
this._toolboxRootView)) | |
96 this._responsiveDesignView.updatePageResizer(); | |
97 }, | 92 }, |
98 | 93 |
99 /** | 94 /** |
100 * @param {!WebInspector.Event} event | 95 * @param {!WebInspector.Event} event |
101 */ | 96 */ |
102 _onBeforeDockSideChange: function(event) | 97 _onBeforeDockSideChange: function(event) |
103 { | 98 { |
104 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolboxRootView) { | 99 if (/** @type {string} */ (event.data.to) === WebInspector.DockControlle
r.State.Undocked && this._toolboxRootView) { |
105 // Hide inspectorView and force layout to mimic the undocked state. | 100 // Hide inspectorView and force layout to mimic the undocked state. |
106 this._rootSplitWidget.hideSidebar(); | 101 this._rootSplitWidget.hideSidebar(); |
107 this._inspectedPagePlaceholder.update(); | 102 this._inspectedPagePlaceholder.update(); |
108 } | 103 } |
109 | 104 |
110 this._changingDockSide = true; | 105 this._changingDockSide = true; |
111 }, | 106 }, |
112 | 107 |
113 /** | 108 /** |
114 * @param {!WebInspector.Event=} event | 109 * @param {!WebInspector.Event=} event |
115 */ | 110 */ |
116 _onDockSideChange: function(event) | 111 _onDockSideChange: function(event) |
117 { | 112 { |
118 this._updateResponsiveDesignView(); | 113 this._updateDeviceModeView(); |
119 | 114 |
120 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); | 115 var toDockSide = event ? /** @type {string} */ (event.data.to) : WebInsp
ector.dockController.dockSide(); |
121 if (toDockSide === WebInspector.DockController.State.Undocked) { | 116 if (toDockSide === WebInspector.DockController.State.Undocked) { |
122 this._updateForUndocked(); | 117 this._updateForUndocked(); |
123 } else if (this._toolboxRootView && event && /** @type {string} */ (even
t.data.from) === WebInspector.DockController.State.Undocked) { | 118 } else if (this._toolboxRootView && event && /** @type {string} */ (even
t.data.from) === WebInspector.DockController.State.Undocked) { |
124 // Don't update yet for smooth transition. | 119 // Don't update yet for smooth transition. |
125 this._rootSplitWidget.hideSidebar(); | 120 this._rootSplitWidget.hideSidebar(); |
126 } else { | 121 } else { |
127 this._updateForDocked(toDockSide); | 122 this._updateForDocked(toDockSide); |
128 } | 123 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 WebInspector.AdvancedAppProvider.prototype = { | 205 WebInspector.AdvancedAppProvider.prototype = { |
211 /** | 206 /** |
212 * @override | 207 * @override |
213 * @return {!WebInspector.App} | 208 * @return {!WebInspector.App} |
214 */ | 209 */ |
215 createApp: function() | 210 createApp: function() |
216 { | 211 { |
217 return WebInspector.AdvancedApp._instance(); | 212 return WebInspector.AdvancedApp._instance(); |
218 } | 213 } |
219 }; | 214 }; |
OLD | NEW |