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

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: Created 4 years, 10 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 * @param {!WebInspector.Setting} showOutlineSetting
9 * @constructor 10 * @constructor
10 */ 11 */
11 WebInspector.DeviceModeToolbar = function(model, showMediaInspectorSetting, show RulersSetting) 12 WebInspector.DeviceModeToolbar = function(model, showMediaInspectorSetting, show RulersSetting, showOutlineSetting)
12 { 13 {
13 this._model = model; 14 this._model = model;
14 this._showMediaInspectorSetting = showMediaInspectorSetting; 15 this._showMediaInspectorSetting = showMediaInspectorSetting;
15 this._showRulersSetting = showRulersSetting; 16 this._showRulersSetting = showRulersSetting;
17 this._showOutlineSetting = showOutlineSetting;
16 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */ 18 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */
17 this._lastMode = new Map(); 19 this._lastMode = new Map();
18 20
19 this._element = createElementWithClass("div", "device-mode-toolbar"); 21 this._element = createElementWithClass("div", "device-mode-toolbar");
20 22
21 var leftContainer = this._element.createChild("div", "device-mode-toolbar-sp acer"); 23 var leftContainer = this._element.createChild("div", "device-mode-toolbar-sp acer");
22 leftContainer.createChild("div", "device-mode-toolbar-spacer"); 24 leftContainer.createChild("div", "device-mode-toolbar-spacer");
23 var leftToolbar = new WebInspector.Toolbar("", leftContainer); 25 var leftToolbar = new WebInspector.Toolbar("", leftContainer);
24 leftToolbar.makeWrappable(); 26 leftToolbar.makeWrappable();
25 this._fillLeftToolbar(leftToolbar); 27 this._fillLeftToolbar(leftToolbar);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 function appendDeviceScaleFactorItem(title, value) 235 function appendDeviceScaleFactorItem(title, value)
234 { 236 {
235 deviceScaleFactorSubmenu.appendCheckboxItem(title, deviceScaleFactor Setting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorValue === va lue, deviceScaleFactorDisabled); 237 deviceScaleFactorSubmenu.appendCheckboxItem(title, deviceScaleFactor Setting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorValue === va lue, deviceScaleFactorDisabled);
236 } 238 }
237 239
238 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _model.reset.bind(this._model), this._model.type() !== WebInspector.DeviceModeMo del.Type.Responsive); 240 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _model.reset.bind(this._model), this._model.type() !== WebInspector.DeviceModeMo del.Type.Responsive);
239 contextMenu.appendSeparator(); 241 contextMenu.appendSeparator();
240 242
241 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None); 243 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None);
242 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None); 244 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None);
245 if (this._model.outlineImage()) {
dgozman 2016/02/01 17:18:27 Instead oh hiding, disable the item (last paramete
mmccoy 2016/02/10 20:06:33 Done.
246 contextMenu.appendCheckboxItem(WebInspector.UIString("Show device fr ame"), this._toggleOutline.bind(this), this._showOutlineSetting.get(), this._mod el.type() === WebInspector.DeviceModeModel.Type.None);
247 };
243 contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false); 248 contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false);
244 contextMenu.appendItemsAtLocation("deviceModeMenu"); 249 contextMenu.appendItemsAtLocation("deviceModeMenu");
245 }, 250 },
246 251
247 _toggleMediaInspector: function() 252 _toggleMediaInspector: function()
248 { 253 {
249 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ()); 254 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ());
250 }, 255 },
251 256
252 _toggleRulers: function() 257 _toggleRulers: function()
253 { 258 {
254 this._showRulersSetting.set(!this._showRulersSetting.get()); 259 this._showRulersSetting.set(!this._showRulersSetting.get());
255 }, 260 },
256 261
262 _toggleOutline: function()
263 {
264 this._showOutlineSetting.set(!this._showOutlineSetting.get());
265 },
266
257 _openNetworkConfig: function() 267 _openNetworkConfig: function()
258 { 268 {
259 InspectorFrontendHost.bringToFront(); 269 InspectorFrontendHost.bringToFront();
260 // TODO(dgozman): make it explicit. 270 // TODO(dgozman): make it explicit.
261 WebInspector.actionRegistry.action("network.show-config").execute(); 271 WebInspector.actionRegistry.action("network.show-config").execute();
262 }, 272 },
263 273
264 /** 274 /**
265 * @param {!Element} element 275 * @param {!Element} element
266 * @return {!WebInspector.ToolbarItem} 276 * @return {!WebInspector.ToolbarItem}
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 this._emulateDevice(device); 513 this._emulateDevice(device);
504 return; 514 return;
505 } 515 }
506 } 516 }
507 } 517 }
508 } 518 }
509 519
510 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null); 520 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null);
511 } 521 }
512 } 522 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698