| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 WebInspector.VBox.call(this); | 37 WebInspector.VBox.call(this); |
| 38 this.registerRequiredCSS("overrides.css"); | 38 this.registerRequiredCSS("overrides.css"); |
| 39 this.registerRequiredCSS("helpScreen.css"); | 39 this.registerRequiredCSS("helpScreen.css"); |
| 40 this.element.classList.add("overrides-view"); | 40 this.element.classList.add("overrides-view"); |
| 41 | 41 |
| 42 this._tabbedPane = new WebInspector.TabbedPane(); | 42 this._tabbedPane = new WebInspector.TabbedPane(); |
| 43 this._tabbedPane.shrinkableTabs = false; | 43 this._tabbedPane.shrinkableTabs = false; |
| 44 this._tabbedPane.verticalTabLayout = true; | 44 this._tabbedPane.verticalTabLayout = true; |
| 45 | 45 |
| 46 | 46 |
| 47 if (!WebInspector.overridesSupport.isInspectingDevice()) { | 47 new WebInspector.OverridesView.DeviceTab().appendAsTab(this._tabbedPane); |
| 48 new WebInspector.OverridesView.DeviceTab().appendAsTab(this._tabbedPane)
; | 48 new WebInspector.OverridesView.MediaTab().appendAsTab(this._tabbedPane); |
| 49 new WebInspector.OverridesView.MediaTab().appendAsTab(this._tabbedPane); | |
| 50 } | |
| 51 new WebInspector.OverridesView.NetworkTab().appendAsTab(this._tabbedPane); | 49 new WebInspector.OverridesView.NetworkTab().appendAsTab(this._tabbedPane); |
| 52 new WebInspector.OverridesView.SensorsTab().appendAsTab(this._tabbedPane); | 50 new WebInspector.OverridesView.SensorsTab().appendAsTab(this._tabbedPane); |
| 53 | 51 |
| 54 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele
ctedEmulateTab", "device"); | 52 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele
ctedEmulateTab", "device"); |
| 55 this._tabbedPane.selectTab(this._lastSelectedTabSetting.get()); | 53 this._tabbedPane.selectTab(this._lastSelectedTabSetting.get()); |
| 56 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele
cted, this._tabSelected, this); | 54 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele
cted, this._tabSelected, this); |
| 57 this._tabbedPane.show(this.element); | 55 this._tabbedPane.show(this.element); |
| 58 | 56 |
| 59 var resetButtonElement = this._tabbedPane.headerElement().createChild("butto
n", "settings-tab-text-button overrides-reset-button"); | 57 var resetButtonElement = this._tabbedPane.headerElement().createChild("butto
n", "settings-tab-text-button overrides-reset-button"); |
| 60 resetButtonElement.textContent = WebInspector.UIString("Reset"); | 58 resetButtonElement.textContent = WebInspector.UIString("Reset"); |
| 61 resetButtonElement.addEventListener("click", WebInspector.overridesSupport.r
eset.bind(WebInspector.overridesSupport), false); | 59 resetButtonElement.addEventListener("click", WebInspector.overridesSupport.r
eset.bind(WebInspector.overridesSupport), false); |
| 62 | 60 |
| 63 this._warningFooter = this.element.createChild("div", "overrides-footer"); | 61 this._warningFooter = this.element.createChild("div", "overrides-footer"); |
| 64 this._overridesWarningUpdated(); | 62 this._overridesWarningUpdated(); |
| 65 | 63 |
| 66 this._splashScreenElement = this.element.createChild("div", "overrides-splas
h-screen"); | 64 this._splashScreenElement = this.element.createChild("div", "overrides-splas
h-screen"); |
| 67 this._splashScreenElement.createTextChild(WebInspector.UIString("Emulation i
s currently disabled. Toggle ")); | 65 this._splashScreenElement.createTextChild(WebInspector.UIString("Emulation i
s currently disabled. Toggle ")); |
| 68 var toggleEmulationButton = new WebInspector.StatusBarButton("", "responsive
-design-status-bar-item"); | 66 var toggleEmulationButton = new WebInspector.StatusBarButton("", "emulation-
status-bar-item"); |
| 69 toggleEmulationButton.addEventListener("click", this._toggleEmulationEnabled
, this); | 67 toggleEmulationButton.addEventListener("click", this._toggleEmulationEnabled
, this); |
| 70 this._splashScreenElement.appendChild(toggleEmulationButton.element); | 68 this._splashScreenElement.appendChild(toggleEmulationButton.element); |
| 71 this._splashScreenElement.createTextChild(WebInspector.UIString("in the main
toolbar to enable it.")); | 69 this._splashScreenElement.createTextChild(WebInspector.UIString("in the main
toolbar to enable it.")); |
| 72 | 70 |
| 73 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport
.Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); | 71 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport
.Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); |
| 74 WebInspector.overridesSupport.settings.emulationEnabled.addChangeListener(th
is._emulationEnabledChanged, this); | 72 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport
.Events.EmulationStateChanged, this._emulationEnabledChanged, this); |
| 75 this._emulationEnabledChanged(); | 73 this._emulationEnabledChanged(); |
| 76 } | 74 } |
| 77 | 75 |
| 78 WebInspector.OverridesView.prototype = { | 76 WebInspector.OverridesView.prototype = { |
| 79 /** | 77 /** |
| 80 * @param {!WebInspector.Event} event | 78 * @param {!WebInspector.Event} event |
| 81 */ | 79 */ |
| 82 _tabSelected: function(event) | 80 _tabSelected: function(event) |
| 83 { | 81 { |
| 84 this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId); | 82 this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId); |
| 85 }, | 83 }, |
| 86 | 84 |
| 87 _overridesWarningUpdated: function() | 85 _overridesWarningUpdated: function() |
| 88 { | 86 { |
| 89 var message = WebInspector.overridesSupport.warningMessage(); | 87 var message = WebInspector.overridesSupport.warningMessage(); |
| 90 this._warningFooter.classList.toggle("hidden", !WebInspector.overridesSu
pport.settings.emulationEnabled.get() || !message); | 88 this._warningFooter.classList.toggle("hidden", !WebInspector.overridesSu
pport.emulationEnabled() || !message); |
| 91 this._warningFooter.textContent = message; | 89 this._warningFooter.textContent = message; |
| 92 }, | 90 }, |
| 93 | 91 |
| 94 _toggleEmulationEnabled: function() | 92 _toggleEmulationEnabled: function() |
| 95 { | 93 { |
| 96 WebInspector.overridesSupport.settings.emulationEnabled.set(true); | 94 WebInspector.overridesSupport.setEmulationEnabled(true); |
| 97 }, | 95 }, |
| 98 | 96 |
| 99 _emulationEnabledChanged: function() | 97 _emulationEnabledChanged: function() |
| 100 { | 98 { |
| 101 this._tabbedPane.element.classList.toggle("hidden", !WebInspector.overri
desSupport.settings.emulationEnabled.get()); | 99 this._tabbedPane.element.classList.toggle("hidden", !WebInspector.overri
desSupport.emulationEnabled()); |
| 102 this._overridesWarningUpdated(); | 100 this._overridesWarningUpdated(); |
| 103 this._splashScreenElement.classList.toggle("hidden", WebInspector.overri
desSupport.settings.emulationEnabled.get()); | 101 this._splashScreenElement.classList.toggle("hidden", WebInspector.overri
desSupport.emulationEnabled()); |
| 104 }, | 102 }, |
| 105 | 103 |
| 106 __proto__: WebInspector.VBox.prototype | 104 __proto__: WebInspector.VBox.prototype |
| 107 } | 105 } |
| 108 | 106 |
| 109 /** | 107 /** |
| 110 * @constructor | 108 * @constructor |
| 111 * @extends {WebInspector.VBox} | 109 * @extends {WebInspector.VBox} |
| 112 * @param {string} id | 110 * @param {string} id |
| 113 * @param {string} name | 111 * @param {string} name |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 WebInspector.OverridesView.Revealer.prototype = { | 644 WebInspector.OverridesView.Revealer.prototype = { |
| 647 /** | 645 /** |
| 648 * @param {!Object} overridesSupport | 646 * @param {!Object} overridesSupport |
| 649 */ | 647 */ |
| 650 reveal: function(overridesSupport) | 648 reveal: function(overridesSupport) |
| 651 { | 649 { |
| 652 InspectorFrontendHost.bringToFront(); | 650 InspectorFrontendHost.bringToFront(); |
| 653 WebInspector.inspectorView.showViewInDrawer("emulation"); | 651 WebInspector.inspectorView.showViewInDrawer("emulation"); |
| 654 } | 652 } |
| 655 } | 653 } |
| OLD | NEW |