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 /** | 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 */ |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 contextMenu.appendCheckboxItem(title, deviceScaleFactorSetting.set.b
ind(deviceScaleFactorSetting, value), deviceScaleFactorSetting.get() === value); | 228 contextMenu.appendCheckboxItem(title, deviceScaleFactorSetting.set.b
ind(deviceScaleFactorSetting, value), deviceScaleFactorSetting.get() === value); |
229 } | 229 } |
230 }, | 230 }, |
231 | 231 |
232 /** | 232 /** |
233 * @param {!WebInspector.ContextMenu} contextMenu | 233 * @param {!WebInspector.ContextMenu} contextMenu |
234 */ | 234 */ |
235 _appendUserAgentMenuItems: function(contextMenu) | 235 _appendUserAgentMenuItems: function(contextMenu) |
236 { | 236 { |
237 var uaSetting = this._model.uaSetting(); | 237 var uaSetting = this._model.uaSetting(); |
238 appendUAItem(WebInspector.UIString("Mobile"), WebInspector.DeviceModeMod
el.UA.Mobile); | 238 appendUAItem(WebInspector.DeviceModeModel.UA.Mobile, WebInspector.Device
ModeModel.UA.Mobile); |
239 appendUAItem(WebInspector.UIString("Mobile (no touch)"), WebInspector.De
viceModeModel.UA.MobileNoTouch); | 239 appendUAItem(WebInspector.DeviceModeModel.UA.MobileNoTouch, WebInspector
.DeviceModeModel.UA.MobileNoTouch); |
240 appendUAItem(WebInspector.UIString("Desktop"), WebInspector.DeviceModeMo
del.UA.Desktop); | 240 appendUAItem(WebInspector.DeviceModeModel.UA.Desktop, WebInspector.Devic
eModeModel.UA.Desktop); |
241 appendUAItem(WebInspector.UIString("Desktop (touch)"), WebInspector.Devi
ceModeModel.UA.DesktopTouch); | 241 appendUAItem(WebInspector.DeviceModeModel.UA.DesktopTouch, WebInspector.
DeviceModeModel.UA.DesktopTouch); |
242 | 242 |
243 /** | 243 /** |
244 * @param {string} title | 244 * @param {string} title |
245 * @param {!WebInspector.DeviceModeModel.UA} value | 245 * @param {!WebInspector.DeviceModeModel.UA} value |
246 */ | 246 */ |
247 function appendUAItem(title, value) | 247 function appendUAItem(title, value) |
248 { | 248 { |
249 contextMenu.appendCheckboxItem(title, uaSetting.set.bind(uaSetting,
value), uaSetting.get() === value); | 249 contextMenu.appendCheckboxItem(title, uaSetting.set.bind(uaSetting,
value), uaSetting.get() === value); |
250 } | 250 } |
251 }, | 251 }, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 499 } |
500 | 500 |
501 var deviceScale = this._model.appliedDeviceScaleFactor(); | 501 var deviceScale = this._model.appliedDeviceScaleFactor(); |
502 if (deviceScale !== this._cachedDeviceScale) { | 502 if (deviceScale !== this._cachedDeviceScale) { |
503 this._deviceScaleItem.setText(WebInspector.UIString("DPR: %.1f", dev
iceScale)); | 503 this._deviceScaleItem.setText(WebInspector.UIString("DPR: %.1f", dev
iceScale)); |
504 this._cachedDeviceScale = deviceScale; | 504 this._cachedDeviceScale = deviceScale; |
505 } | 505 } |
506 | 506 |
507 var uaType = this._model.appliedUserAgentType(); | 507 var uaType = this._model.appliedUserAgentType(); |
508 if (uaType !== this._cachedUaType) { | 508 if (uaType !== this._cachedUaType) { |
509 var uaTitle = WebInspector.UIString("Desktop"); | 509 this._uaItem.setText(uaType); |
510 if (uaType === WebInspector.DeviceModeModel.UA.Mobile) | |
511 uaTitle = WebInspector.UIString("Mobile"); | |
512 if (uaType === WebInspector.DeviceModeModel.UA.MobileNoTouch) | |
513 uaTitle = WebInspector.UIString("Mobile (no touch)"); | |
514 if (uaType === WebInspector.DeviceModeModel.UA.DesktopTouch) | |
515 uaTitle = WebInspector.UIString("Desktop (touch)"); | |
516 this._uaItem.setText(uaTitle); | |
517 this._cachedUaType = uaType; | 510 this._cachedUaType = uaType; |
518 } | 511 } |
519 | 512 |
520 var deviceItemTitle = WebInspector.UIString("None"); | 513 var deviceItemTitle = WebInspector.UIString("None"); |
521 if (this._model.type() === WebInspector.DeviceModeModel.Type.Responsive) | 514 if (this._model.type() === WebInspector.DeviceModeModel.Type.Responsive) |
522 deviceItemTitle = WebInspector.UIString("Responsive"); | 515 deviceItemTitle = WebInspector.UIString("Responsive"); |
523 if (this._model.type() === WebInspector.DeviceModeModel.Type.Device) | 516 if (this._model.type() === WebInspector.DeviceModeModel.Type.Device) |
524 deviceItemTitle = this._model.device().title; | 517 deviceItemTitle = this._model.device().title; |
525 this._deviceSelectItem.setText(deviceItemTitle); | 518 this._deviceSelectItem.setText(deviceItemTitle); |
526 | 519 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 this._emulateDevice(device); | 557 this._emulateDevice(device); |
565 return; | 558 return; |
566 } | 559 } |
567 } | 560 } |
568 } | 561 } |
569 } | 562 } |
570 | 563 |
571 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null,
null); | 564 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null,
null); |
572 } | 565 } |
573 } | 566 } |
OLD | NEW |