OLD | NEW |
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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Emulation.DeviceModeToolbar = class { | 7 Emulation.DeviceModeToolbar = class { |
8 /** | 8 /** |
9 * @param {!Emulation.DeviceModeModel} model | 9 * @param {!Emulation.DeviceModeModel} model |
10 * @param {!Common.Setting} showMediaInspectorSetting | 10 * @param {!Common.Setting} showMediaInspectorSetting |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 _modeMenuClicked(event) { | 445 _modeMenuClicked(event) { |
446 var device = this._model.device(); | 446 var device = this._model.device(); |
447 var model = this._model; | 447 var model = this._model; |
448 | 448 |
449 if (device.modes.length === 2 && device.modes[0].orientation !== device.mode
s[1].orientation) { | 449 if (device.modes.length === 2 && device.modes[0].orientation !== device.mode
s[1].orientation) { |
450 model.emulate(model.type(), model.device(), model.mode() === device.modes[
0] ? device.modes[1] : device.modes[0]); | 450 model.emulate(model.type(), model.device(), model.mode() === device.modes[
0] ? device.modes[1] : device.modes[0]); |
451 return; | 451 return; |
452 } | 452 } |
453 | 453 |
454 var contextMenu = new UI.ContextMenu( | 454 var contextMenu = new UI.ContextMenu( |
455 /** @type {!Event} */ (event.data), false, event.target.element.totalOff
setLeft(), | 455 /** @type {!Event} */ (event.data), false, this._modeButton.element.tota
lOffsetLeft(), |
456 event.target.element.totalOffsetTop() + event.target.element.offsetHeigh
t); | 456 this._modeButton.element.totalOffsetTop() + this._modeButton.element.off
setHeight); |
457 addOrientation(Emulation.EmulatedDevice.Vertical, Common.UIString('Portrait'
)); | 457 addOrientation(Emulation.EmulatedDevice.Vertical, Common.UIString('Portrait'
)); |
458 addOrientation(Emulation.EmulatedDevice.Horizontal, Common.UIString('Landsca
pe')); | 458 addOrientation(Emulation.EmulatedDevice.Horizontal, Common.UIString('Landsca
pe')); |
459 contextMenu.show(); | 459 contextMenu.show(); |
460 | 460 |
461 /** | 461 /** |
462 * @param {string} orientation | 462 * @param {string} orientation |
463 * @param {string} title | 463 * @param {string} title |
464 */ | 464 */ |
465 function addOrientation(orientation, title) { | 465 function addOrientation(orientation, title) { |
466 var modes = device.modesForOrientation(orientation); | 466 var modes = device.modesForOrientation(orientation); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 this._emulateDevice(device); | 581 this._emulateDevice(device); |
582 return; | 582 return; |
583 } | 583 } |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 this._model.emulate(Emulation.DeviceModeModel.Type.Responsive, null, null); | 588 this._model.emulate(Emulation.DeviceModeModel.Type.Responsive, null, null); |
589 } | 589 } |
590 }; | 590 }; |
OLD | NEW |