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

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

Issue 1569893003: Add "Request app banner" context menu in DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android support Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.DeviceModeView = function() 9 WebInspector.DeviceModeView = function()
10 { 10 {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 { 541 {
542 deviceScaleFactorSubmenu.appendCheckboxItem(title, deviceScaleFactor Setting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorValue === va lue, deviceScaleFactorDisabled); 542 deviceScaleFactorSubmenu.appendCheckboxItem(title, deviceScaleFactor Setting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorValue === va lue, deviceScaleFactorDisabled);
543 } 543 }
544 544
545 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _model.reset.bind(this._model), this._model.type() !== WebInspector.DeviceModeMo del.Type.Responsive); 545 contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this. _model.reset.bind(this._model), this._model.type() !== WebInspector.DeviceModeMo del.Type.Responsive);
546 contextMenu.appendSeparator(); 546 contextMenu.appendSeparator();
547 547
548 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None); 548 contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries "), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get() , this._model.type() === WebInspector.DeviceModeModel.Type.None);
549 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None); 549 contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), thi s._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() == = WebInspector.DeviceModeModel.Type.None);
550 contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false); 550 contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false);
551 contextMenu.appendItemsAtLocation("deviceModeMenu");
551 }, 552 },
552 553
553 _toggleMediaInspector: function() 554 _toggleMediaInspector: function()
554 { 555 {
555 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ()); 556 this._showMediaInspectorSetting.set(!this._showMediaInspectorSetting.get ());
556 }, 557 },
557 558
558 _toggleRulers: function() 559 _toggleRulers: function()
559 { 560 {
560 this._showRulersSetting.set(!this._showRulersSetting.get()); 561 this._showRulersSetting.set(!this._showRulersSetting.get());
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1032
1032 WebInspector.DeviceModeView.ActionDelegate.prototype = { 1033 WebInspector.DeviceModeView.ActionDelegate.prototype = {
1033 /** 1034 /**
1034 * @override 1035 * @override
1035 * @param {!WebInspector.Context} context 1036 * @param {!WebInspector.Context} context
1036 * @param {string} actionId 1037 * @param {string} actionId
1037 * @return {boolean} 1038 * @return {boolean}
1038 */ 1039 */
1039 handleAction: function(context, actionId) 1040 handleAction: function(context, actionId)
1040 { 1041 {
1041 if (actionId === "emulation.toggle-device-mode" && WebInspector.DeviceMo deView._wrapperInstance) { 1042 if (WebInspector.DeviceModeView._wrapperInstance) {
1042 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode(); 1043 if (actionId === "emulation.toggle-device-mode") {
1043 return true; 1044 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode() ;
1044 } 1045 return true;
1045 if (actionId === "emulation.toggle-device-toolbar" && WebInspector.Devic eModeView._wrapperInstance) { 1046 }
1046 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceToolbar(); 1047 if (actionId === "emulation.toggle-device-toolbar") {
1047 return true; 1048 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceToolba r();
1049 return true;
1050 }
1051 if (actionId === "emulation.open-app-banner") {
1052 WebInspector.DeviceModeView._wrapperInstance._openAppBanner();
1053 return true;
1054 }
1048 } 1055 }
1049 return false; 1056 return false;
1050 } 1057 }
1051 } 1058 }
1052 1059
1053 1060
1054 /** 1061 /**
1055 * @extends {WebInspector.VBox} 1062 * @extends {WebInspector.VBox}
1056 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder 1063 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder
1057 * @constructor 1064 * @constructor
(...skipping 17 matching lines...) Expand all
1075 { 1082 {
1076 if (this._showDeviceToolbarSetting.get()) 1083 if (this._showDeviceToolbarSetting.get())
1077 this._deviceModeView.toggleDeviceMode(); 1084 this._deviceModeView.toggleDeviceMode();
1078 }, 1085 },
1079 1086
1080 _toggleDeviceToolbar: function() 1087 _toggleDeviceToolbar: function()
1081 { 1088 {
1082 this._showDeviceToolbarSetting.set(!this._showDeviceToolbarSetting.get() ); 1089 this._showDeviceToolbarSetting.set(!this._showDeviceToolbarSetting.get() );
1083 }, 1090 },
1084 1091
1092 _openAppBanner: function()
1093 {
1094 this._deviceModeView._model.openAppBanner();
1095 },
1096
1085 _update: function() 1097 _update: function()
1086 { 1098 {
1087 if (this._showDeviceToolbarSetting.get()) { 1099 if (this._showDeviceToolbarSetting.get()) {
1088 this._deviceModeView.show(this.element); 1100 this._deviceModeView.show(this.element);
1089 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); 1101 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
1090 this._inspectedPagePlaceholder.show(this._deviceModeView.element); 1102 this._inspectedPagePlaceholder.show(this._deviceModeView.element);
1091 } else { 1103 } else {
1092 this._deviceModeView.detach(); 1104 this._deviceModeView.detach();
1093 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); 1105 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
1094 this._inspectedPagePlaceholder.show(this.element); 1106 this._inspectedPagePlaceholder.show(this.element);
1095 this._deviceModeView._model.emulate(WebInspector.DeviceModeModel.Typ e.None, null, null); 1107 this._deviceModeView._model.emulate(WebInspector.DeviceModeModel.Typ e.None, null, null);
1096 } 1108 }
1097 }, 1109 },
1098 1110
1099 __proto__: WebInspector.VBox.prototype 1111 __proto__: WebInspector.VBox.prototype
1100 } 1112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698