Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: Source/devtools/front_end/main/AdvancedApp.js

Issue 342163002: DevTools: move emulation button into the base App.js. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments addressed. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/inspector.css ('k') | Source/devtools/front_end/main/App.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 WebInspector.App.call(this); 11 WebInspector.App.call(this);
12 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.BeforeDockSideChanged, this._openToolboxWindow, this); 12 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.BeforeDockSideChanged, this._openToolboxWindow, this);
13
14 this._toggleEmulationButton = new WebInspector.StatusBarButton(WebInspector. UIString("Toggle emulation enabled."), "responsive-design-status-bar-item");
15 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.settings .emulationEnabled.get();
16 this._toggleEmulationButton.addEventListener("click", this._toggleEmulationE nabled, this);
17 WebInspector.overridesSupport.settings.emulationEnabled.addChangeListener(th is._emulationEnabledChanged, this);
18 }; 13 };
19 14
20 WebInspector.AdvancedApp.prototype = { 15 WebInspector.AdvancedApp.prototype = {
21 _toggleEmulationEnabled: function()
22 {
23 WebInspector.overridesSupport.settings.emulationEnabled.set(!this._toggl eEmulationButton.toggled);
24 },
25
26 _emulationEnabledChanged: function()
27 {
28 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.sett ings.emulationEnabled.get();
29 if (!WebInspector.experimentsSettings.responsiveDesign.isEnabled() && We bInspector.overridesSupport.settings.emulationEnabled.get())
30 WebInspector.inspectorView.showViewInDrawer("emulation", true);
31 },
32
33 createRootView: function() 16 createRootView: function()
34 { 17 {
35 var rootView = new WebInspector.RootView(); 18 var rootView = new WebInspector.RootView();
36 19
37 this._rootSplitView = new WebInspector.SplitView(false, true, WebInspect or.dockController.canDock() ? "InspectorView.splitViewState" : "InspectorView.du mmySplitViewState", 300, 300); 20 this._rootSplitView = new WebInspector.SplitView(false, true, WebInspect or.dockController.canDock() ? "InspectorView.splitViewState" : "InspectorView.du mmySplitViewState", 300, 300);
38 this._rootSplitView.show(rootView.element); 21 this._rootSplitView.show(rootView.element);
39 22
40 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement()); 23 WebInspector.inspectorView.show(this._rootSplitView.sidebarElement());
41 24
42 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold er(); 25 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlacehold er();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return; 153 return;
171 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data); 154 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data);
172 InspectorFrontendHost.setInspectedPageBounds(bounds); 155 InspectorFrontendHost.setInspectedPageBounds(bounds);
173 }, 156 },
174 157
175 __proto__: WebInspector.App.prototype 158 __proto__: WebInspector.App.prototype
176 }; 159 };
177 160
178 /** 161 /**
179 * @constructor 162 * @constructor
180 * @implements {WebInspector.StatusBarButton.Provider}
181 */
182 WebInspector.AdvancedApp.ResponsiveDesignButtonProvider = function()
183 {
184 }
185
186 WebInspector.AdvancedApp.ResponsiveDesignButtonProvider.prototype = {
187 /**
188 * @return {?WebInspector.StatusBarButton}
189 */
190 button: function()
191 {
192 if (!(WebInspector.app instanceof WebInspector.AdvancedApp))
193 return null;
194 return /** @type {!WebInspector.AdvancedApp} */ (WebInspector.app)._togg leEmulationButton || null;
195 }
196 }
197
198 /**
199 * @constructor
200 */ 163 */
201 WebInspector.Toolbox = function() 164 WebInspector.Toolbox = function()
202 { 165 {
203 if (!window.opener) 166 if (!window.opener)
204 return; 167 return;
205 168
206 WebInspector.zoomManager = window.opener.WebInspector.zoomManager; 169 WebInspector.zoomManager = window.opener.WebInspector.zoomManager;
207 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; 170 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport;
208 WebInspector.settings = window.opener.WebInspector.settings; 171 WebInspector.settings = window.opener.WebInspector.settings;
209 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings; 172 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings;
210 WebInspector.installPortStyles(); 173 WebInspector.installPortStyles();
211 174
212 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app); 175 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app);
213 var rootView = new WebInspector.RootView(); 176 var rootView = new WebInspector.RootView();
214 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ; 177 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ;
215 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true)); 178 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true));
216 if (WebInspector.experimentsSettings.responsiveDesign.isEnabled()) { 179 if (WebInspector.experimentsSettings.responsiveDesign.isEnabled()) {
217 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this. _inspectedPagePlaceholder); 180 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this. _inspectedPagePlaceholder);
218 this._responsiveDesignView.show(rootView.element); 181 this._responsiveDesignView.show(rootView.element);
219 } else { 182 } else {
220 this._inspectedPagePlaceholder.show(rootView.element); 183 this._inspectedPagePlaceholder.show(rootView.element);
221 } 184 }
222 rootView.attachToBody(); 185 rootView.attachToBody();
223 advancedApp._toolboxLoaded(this); 186 advancedApp._toolboxLoaded(this);
224 } 187 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/inspector.css ('k') | Source/devtools/front_end/main/App.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698