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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js

Issue 1397403003: [DevTools] Remove HelpScreen, turn SettingsScreen into dialog and web component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screens
Patch Set: markAsRoot Created 5 years, 2 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {function()} onHide 33 * @extends {WebInspector.VBox}
34 * @extends {WebInspector.HelpScreen}
35 */ 34 */
36 WebInspector.SettingsScreen = function(onHide) 35 WebInspector.SettingsScreen = function()
37 { 36 {
38 WebInspector.HelpScreen.call(this); 37 WebInspector.VBox.call(this, true);
38 this.registerRequiredCSS("settings/settingsScreen.css");
39 this.element.id = "settings-screen"; 39 this.element.id = "settings-screen";
40 40
41 /** @type {function()} */ 41 this.contentElement.tabIndex = 0;
42 this._onHide = onHide; 42 this.contentElement.classList.add("help-window-main");
43 43 this.contentElement.classList.add("vbox");
44 this._contentElement = this.element.createChild("div", "help-window-main");
45 var settingsLabelElement = createElementWithClass("div", "help-window-label" ); 44 var settingsLabelElement = createElementWithClass("div", "help-window-label" );
46 settingsLabelElement.createTextChild(WebInspector.UIString("Settings")); 45 settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));
47 this._contentElement.appendChild(this.createCloseButton());
48 46
49 this._tabbedPane = new WebInspector.TabbedPane(); 47 this._tabbedPane = new WebInspector.TabbedPane();
50 this._tabbedPane.insertBeforeTabStrip(settingsLabelElement); 48 this._tabbedPane.insertBeforeTabStrip(settingsLabelElement);
51 this._tabbedPane.setShrinkableTabs(false); 49 this._tabbedPane.setShrinkableTabs(false);
52 this._tabbedPane.setVerticalTabLayout(true); 50 this._tabbedPane.setVerticalTabLayout(true);
53 this._tabbedPane.appendTab("general", WebInspector.UIString("General"), new WebInspector.GenericSettingsTab()); 51 this._tabbedPane.appendTab("general", WebInspector.UIString("General"), new WebInspector.GenericSettingsTab());
54 this._tabbedPane.appendTab("workspace", WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab()); 52 this._tabbedPane.appendTab("workspace", WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab());
55 if (Runtime.experiments.supportEnabled()) 53 if (Runtime.experiments.supportEnabled())
56 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab()); 54 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab());
57 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view"); 55 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view");
58 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView()); 56 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView());
59 57
60 this.element.addEventListener("keydown", this._keyDown.bind(this), false); 58 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
61 this._developerModeCounter = 0; 59 this._developerModeCounter = 0;
60 this.setDefaultFocusedElement(this.contentElement);
62 } 61 }
63 62
64 WebInspector.SettingsScreen.prototype = { 63 WebInspector.SettingsScreen.prototype = {
65 /** 64 /**
66 * @override 65 * @override
67 */ 66 */
68 wasShown: function() 67 wasShown: function()
69 { 68 {
70 this._tabbedPane.selectTab("general"); 69 this._tabbedPane.selectTab("general");
71 this._tabbedPane.show(this._contentElement); 70 this._tabbedPane.show(this.contentElement);
72 WebInspector.HelpScreen.prototype.wasShown.call(this); 71 WebInspector.VBox.prototype.wasShown.call(this);
73 }, 72 },
74 73
75 /** 74 /**
76 * @param {string} name 75 * @param {string} name
77 */ 76 */
78 selectTab: function(name) 77 selectTab: function(name)
79 { 78 {
80 this._tabbedPane.selectTab(name); 79 this._tabbedPane.selectTab(name);
81 }, 80 },
82 81
83 /** 82 /**
84 * @override
85 * @return {boolean}
86 */
87 isClosingKey: function(keyCode)
88 {
89 return [
90 WebInspector.KeyboardShortcut.Keys.Enter.code,
91 WebInspector.KeyboardShortcut.Keys.Esc.code,
92 ].indexOf(keyCode) >= 0;
93 },
94
95 /**
96 * @override
97 */
98 willHide: function()
99 {
100 this._onHide();
101 WebInspector.HelpScreen.prototype.willHide.call(this);
102 },
103
104 /**
105 * @param {!Event} event 83 * @param {!Event} event
106 */ 84 */
107 _keyDown: function(event) 85 _keyDown: function(event)
108 { 86 {
109 var shiftKeyCode = 16; 87 var shiftKeyCode = 16;
110 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5) 88 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5)
111 this.element.classList.add("settings-developer-mode"); 89 this.element.classList.add("settings-developer-mode");
112 }, 90 },
113 91
114 __proto__: WebInspector.HelpScreen.prototype 92 __proto__: WebInspector.VBox.prototype
115 } 93 }
116 94
117 /** 95 /**
118 * @constructor 96 * @constructor
119 * @extends {WebInspector.VBox} 97 * @extends {WebInspector.VBox}
120 * @param {string} name 98 * @param {string} name
121 * @param {string=} id 99 * @param {string=} id
122 */ 100 */
123 WebInspector.SettingsTab = function(name, id) 101 WebInspector.SettingsTab = function(name, id)
124 { 102 {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 __proto__: WebInspector.SettingsTab.prototype 531 __proto__: WebInspector.SettingsTab.prototype
554 } 532 }
555 533
556 /** 534 /**
557 * @constructor 535 * @constructor
558 */ 536 */
559 WebInspector.SettingsController = function() 537 WebInspector.SettingsController = function()
560 { 538 {
561 /** @type {?WebInspector.SettingsScreen} */ 539 /** @type {?WebInspector.SettingsScreen} */
562 this._settingsScreen; 540 this._settingsScreen;
563 this._resizeBound = this._resize.bind(this);
564 } 541 }
565 542
566 WebInspector.SettingsController.prototype = { 543 WebInspector.SettingsController.prototype = {
567 _onHideSettingsScreen: function()
568 {
569 var window = this._settingsScreen.element.ownerDocument.defaultView;
570 window.removeEventListener("resize", this._resizeBound, false);
571 delete this._settingsScreenVisible;
572 },
573
574 /** 544 /**
575 * @param {string=} name 545 * @param {string=} name
576 */ 546 */
577 showSettingsScreen: function(name) 547 showSettingsScreen: function(name)
578 { 548 {
579 if (!this._settingsScreen) 549 if (!this._settingsScreen)
580 this._settingsScreen = new WebInspector.SettingsScreen(this._onHideS ettingsScreen.bind(this)); 550 this._settingsScreen = new WebInspector.SettingsScreen();
581 this._settingsScreen.showModal(); 551
552 var dialog = new WebInspector.Dialog();
553 dialog.addCloseButton();
554 this._settingsScreen.show(dialog.element);
555 dialog.show();
556
582 if (name) 557 if (name)
583 this._settingsScreen.selectTab(name); 558 this._settingsScreen.selectTab(name);
584 this._settingsScreenVisible = true;
585 var window = this._settingsScreen.element.ownerDocument.defaultView;
586 window.addEventListener("resize", this._resizeBound, false);
587 },
588
589 _resize: function()
590 {
591 if (this._settingsScreen && this._settingsScreen.isShowing())
592 this._settingsScreen.doResize();
593 } 559 }
594 } 560 }
595 561
596 /** 562 /**
597 * @constructor 563 * @constructor
598 * @implements {WebInspector.ActionDelegate} 564 * @implements {WebInspector.ActionDelegate}
599 */ 565 */
600 WebInspector.SettingsController.ActionDelegate = function() { } 566 WebInspector.SettingsController.ActionDelegate = function() { }
601 567
602 WebInspector.SettingsController.ActionDelegate.prototype = { 568 WebInspector.SettingsController.ActionDelegate.prototype = {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 var columnId = columns[i]; 1133 var columnId = columns[i];
1168 var editElement = this._addInputElements.get(columnId); 1134 var editElement = this._addInputElements.get(columnId);
1169 this._setEditElementValue(editElement, ""); 1135 this._setEditElementValue(editElement, "");
1170 } 1136 }
1171 }, 1137 },
1172 1138
1173 __proto__: WebInspector.SettingsList.prototype 1139 __proto__: WebInspector.SettingsList.prototype
1174 } 1140 }
1175 1141
1176 WebInspector._settingsController = new WebInspector.SettingsController(); 1142 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698