| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 this._deviceSelectItem = new UI.ToolbarMenuButton(this._appendDeviceMenuItem
s.bind(this)); | 86 this._deviceSelectItem = new UI.ToolbarMenuButton(this._appendDeviceMenuItem
s.bind(this)); |
| 87 this._deviceSelectItem.setGlyph(''); | 87 this._deviceSelectItem.setGlyph(''); |
| 88 this._deviceSelectItem.turnIntoSelect(95); | 88 this._deviceSelectItem.turnIntoSelect(95); |
| 89 toolbar.appendToolbarItem(this._deviceSelectItem); | 89 toolbar.appendToolbarItem(this._deviceSelectItem); |
| 90 } | 90 } |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * @param {!UI.Toolbar} toolbar | 93 * @param {!UI.Toolbar} toolbar |
| 94 */ | 94 */ |
| 95 _fillMainToolbar(toolbar) { | 95 _fillMainToolbar(toolbar) { |
| 96 var widthInput = createElementWithClass('input', 'device-mode-size-input'); | 96 var widthInput = UI.createInput('device-mode-size-input', 'text'); |
| 97 widthInput.maxLength = 4; | 97 widthInput.maxLength = 4; |
| 98 widthInput.type = 'text'; | |
| 99 widthInput.title = Common.UIString('Width'); | 98 widthInput.title = Common.UIString('Width'); |
| 100 this._updateWidthInput = | 99 this._updateWidthInput = |
| 101 UI.bindInput(widthInput, this._applyWidth.bind(this), Emulation.DeviceMo
deModel.deviceSizeValidator, true); | 100 UI.bindInput(widthInput, this._applyWidth.bind(this), Emulation.DeviceMo
deModel.deviceSizeValidator, true); |
| 102 this._widthInput = widthInput; | 101 this._widthInput = widthInput; |
| 103 this._widthItem = this._wrapToolbarItem(widthInput); | 102 this._widthItem = this._wrapToolbarItem(widthInput); |
| 104 toolbar.appendToolbarItem(this._widthItem); | 103 toolbar.appendToolbarItem(this._widthItem); |
| 105 | 104 |
| 106 var xElement = createElementWithClass('div', 'device-mode-x'); | 105 var xElement = createElementWithClass('div', 'device-mode-x'); |
| 107 xElement.textContent = '\u00D7'; | 106 xElement.textContent = '\u00D7'; |
| 108 this._xItem = this._wrapToolbarItem(xElement); | 107 this._xItem = this._wrapToolbarItem(xElement); |
| 109 toolbar.appendToolbarItem(this._xItem); | 108 toolbar.appendToolbarItem(this._xItem); |
| 110 | 109 |
| 111 var heightInput = createElementWithClass('input', 'device-mode-size-input'); | 110 var heightInput = UI.createInput('device-mode-size-input', 'text'); |
| 112 heightInput.maxLength = 4; | 111 heightInput.maxLength = 4; |
| 113 heightInput.type = 'text'; | |
| 114 heightInput.title = Common.UIString('Height (leave empty for full)'); | 112 heightInput.title = Common.UIString('Height (leave empty for full)'); |
| 115 this._updateHeightInput = UI.bindInput(heightInput, this._applyHeight.bind(t
his), validateHeight, true); | 113 this._updateHeightInput = UI.bindInput(heightInput, this._applyHeight.bind(t
his), validateHeight, true); |
| 116 this._heightInput = heightInput; | 114 this._heightInput = heightInput; |
| 117 this._heightItem = this._wrapToolbarItem(heightInput); | 115 this._heightItem = this._wrapToolbarItem(heightInput); |
| 118 toolbar.appendToolbarItem(this._heightItem); | 116 toolbar.appendToolbarItem(this._heightItem); |
| 119 | 117 |
| 120 /** | 118 /** |
| 121 * @param {string} value | 119 * @param {string} value |
| 122 * @return {boolean} | 120 * @return {boolean} |
| 123 */ | 121 */ |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 this._emulateDevice(device); | 588 this._emulateDevice(device); |
| 591 return; | 589 return; |
| 592 } | 590 } |
| 593 } | 591 } |
| 594 } | 592 } |
| 595 } | 593 } |
| 596 | 594 |
| 597 this._model.emulate(Emulation.DeviceModeModel.Type.Responsive, null, null); | 595 this._model.emulate(Emulation.DeviceModeModel.Type.Responsive, null, null); |
| 598 } | 596 } |
| 599 }; | 597 }; |
| OLD | NEW |