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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeToolbar.js

Issue 1650243004: [DevTools] Option to show device frames in emulation mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disallow rulers and device frame to be show simultaneously Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @param {!WebInspector.DeviceModeModel} model 6 * @param {!WebInspector.DeviceModeModel} model
7 * @param {!WebInspector.Setting} showMediaInspectorSetting 7 * @param {!WebInspector.Setting} showMediaInspectorSetting
8 * @param {!WebInspector.Setting} showRulersSetting 8 * @param {!WebInspector.Setting} showRulersSetting
9 * @constructor 9 * @constructor
10 */ 10 */
11 WebInspector.DeviceModeToolbar = function(model, showMediaInspectorSetting, show RulersSetting) 11 WebInspector.DeviceModeToolbar = function(model, showMediaInspectorSetting, show RulersSetting)
12 { 12 {
13 this._model = model; 13 this._model = model;
14 this._showMediaInspectorSetting = showMediaInspectorSetting; 14 this._showMediaInspectorSetting = showMediaInspectorSetting;
15 this._showRulersSetting = showRulersSetting; 15 this._showRulersSetting = showRulersSetting;
16 16
17 this._deviceOutlineSetting = this._model.deviceOutlineSetting();
17 this._showDeviceScaleFactorSetting = WebInspector.settings.createSetting("em ulation.showDeviceScaleFactor", false); 18 this._showDeviceScaleFactorSetting = WebInspector.settings.createSetting("em ulation.showDeviceScaleFactor", false);
18 this._showDeviceScaleFactorSetting.addChangeListener(this._updateDeviceScale FactorVisibility, this); 19 this._showDeviceScaleFactorSetting.addChangeListener(this._updateDeviceScale FactorVisibility, this);
19 20
20 this._showUserAgentTypeSetting = WebInspector.settings.createSetting("emulat ion.showUserAgentType", false); 21 this._showUserAgentTypeSetting = WebInspector.settings.createSetting("emulat ion.showUserAgentType", false);
21 this._showUserAgentTypeSetting.addChangeListener(this._updateUserAgentTypeVi sibility, this); 22 this._showUserAgentTypeSetting.addChangeListener(this._updateUserAgentTypeVi sibility, this);
22 23
23 this._showNetworkConditionsSetting = WebInspector.settings.createSetting("em ulation.showNetworkConditions", false); 24 this._showNetworkConditionsSetting = WebInspector.settings.createSetting("em ulation.showNetworkConditions", false);
24 this._showNetworkConditionsSetting.addChangeListener(this._updateNetworkCond itionsVisibility, this); 25 this._showNetworkConditionsSetting.addChangeListener(this._updateNetworkCond itionsVisibility, this);
25 26
26 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */ 27 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 /** 264 /**
264 * @param {!WebInspector.ContextMenu} contextMenu 265 * @param {!WebInspector.ContextMenu} contextMenu
265 */ 266 */
266 _appendOptionsMenuItems: function(contextMenu) 267 _appendOptionsMenuItems: function(contextMenu)
267 { 268 {
268 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device pixel ratio"), this._toggleDeviceScaleFactor.bind(this), this._showDeviceScaleFactorSe tting.get(), this._model.type() === WebInspector.DeviceModeModel.Type.None); 269 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device pixel ratio"), this._toggleDeviceScaleFactor.bind(this), this._showDeviceScaleFactorSe tting.get(), this._model.type() === WebInspector.DeviceModeModel.Type.None);
269 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device type") , this._toggleUserAgentType.bind(this), this._showUserAgentTypeSetting.get(), th is._model.type() === WebInspector.DeviceModeModel.Type.None); 270 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device type") , this._toggleUserAgentType.bind(this), this._showUserAgentTypeSetting.get(), th is._model.type() === WebInspector.DeviceModeModel.Type.None);
270 contextMenu.appendCheckboxItem(WebInspector.UIString("Show throttling"), this._toggleNetworkConditions.bind(this), this._showNetworkConditionsSetting.ge t(), this._model.type() === WebInspector.DeviceModeModel.Type.None); 271 contextMenu.appendCheckboxItem(WebInspector.UIString("Show throttling"), this._toggleNetworkConditions.bind(this), this._showNetworkConditionsSetting.ge t(), this._model.type() === WebInspector.DeviceModeModel.Type.None);
271 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None); 272 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None);
272 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None); 273 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None);
273 contextMenu.appendSeparator(); 274 if (Runtime.experiments.isEnabled("deviceFrames")) {
275 // contextMenu.appendCheckboxItem(WebInspector.UIString("Show device frame"), this._deviceOutlineSetting.set.bind(this._deviceOutlineSetting, !this. _deviceOutlineSetting.get()), this._deviceOutlineSetting.get() && this._model.ou tlineImage() !== "", (this._model.type() === WebInspector.DeviceModeModel.Type.N one || this._model.outlineImage() === ""));
dgozman 2016/04/13 22:52:06 nit: remove commented code
mmccoy 2016/04/19 14:42:19 Done.
276 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device fr ame"), this._toggleDeviceFrames.bind(this), this._deviceOutlineSetting.get() && this._model.outlineImage() !== "", (this._model.type() === WebInspector.DeviceMo deModel.Type.None || this._model.outlineImage() === ""));
277 }
274 contextMenu.appendItemsAtLocation("deviceModeMenu"); 278 contextMenu.appendItemsAtLocation("deviceModeMenu");
275 contextMenu.appendSeparator(); 279 contextMenu.appendSeparator();
276 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _reset.bind(this)); 280 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _reset.bind(this));
277 }, 281 },
278 282
279 _toggleDeviceScaleFactor: function() 283 _toggleDeviceScaleFactor: function()
280 { 284 {
281 this._showDeviceScaleFactorSetting.set(!this._showDeviceScaleFactorSetti ng.get()); 285 this._showDeviceScaleFactorSetting.set(!this._showDeviceScaleFactorSetti ng.get());
282 }, 286 },
283 287
288 _toggleDeviceFrames: function()
289 {
290 if (this._showRulersSetting.get()) {
291 this._toggleRulers();
dgozman 2016/04/13 22:52:06 We should instead do this in DeviceModeView and av
mmccoy 2016/04/19 14:42:19 Ack.
292 }
293 this._deviceOutlineSetting.set(!this._deviceOutlineSetting.get());
294 },
295
284 _toggleUserAgentType: function() 296 _toggleUserAgentType: function()
285 { 297 {
286 this._showUserAgentTypeSetting.set(!this._showUserAgentTypeSetting.get() ); 298 this._showUserAgentTypeSetting.set(!this._showUserAgentTypeSetting.get() );
287 }, 299 },
288 300
289 _toggleMediaInspector: function() 301 _toggleMediaInspector: function()
290 { 302 {
291 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ()); 303 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ());
292 }, 304 },
293 305
294 _toggleRulers: function() 306 _toggleRulers: function()
295 { 307 {
308 if (this._deviceOutlineSetting.get()) {
309 this._toggleDeviceFrames();
dgozman 2016/04/13 22:52:06 ditto
mmccoy 2016/04/19 14:42:19 Ack.
310 }
296 this._showRulersSetting.set(!this._showRulersSetting.get()); 311 this._showRulersSetting.set(!this._showRulersSetting.get());
297 }, 312 },
298 313
299 _toggleNetworkConditions: function() 314 _toggleNetworkConditions: function()
300 { 315 {
301 this._showNetworkConditionsSetting.set(!this._showNetworkConditionsSetti ng.get()); 316 this._showNetworkConditionsSetting.set(!this._showNetworkConditionsSetti ng.get());
302 }, 317 },
303 318
304 _reset: function() 319 _reset: function()
305 { 320 {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 this._emulateDevice(device); 587 this._emulateDevice(device);
573 return; 588 return;
574 } 589 }
575 } 590 }
576 } 591 }
577 } 592 }
578 593
579 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null); 594 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null);
580 } 595 }
581 } 596 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698