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

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: 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.markAsRoot();
yurys 2015/10/13 00:52:11 Drop this.
dgozman 2015/10/13 01:57:42 Done.
39 this.registerRequiredCSS("settings/settingsScreen.css");
39 this.element.id = "settings-screen"; 40 this.element.id = "settings-screen";
40 41
41 /** @type {function()} */ 42 this.contentElement.tabIndex = 0;
42 this._onHide = onHide; 43 this.contentElement.classList.add("help-window-main");
43 44 this.contentElement.classList.add("vbox");
44 this._contentElement = this.element.createChild("div", "help-window-main");
45 var settingsLabelElement = createElementWithClass("div", "help-window-label" ); 45 var settingsLabelElement = createElementWithClass("div", "help-window-label" );
46 settingsLabelElement.createTextChild(WebInspector.UIString("Settings")); 46 settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));
47 this._contentElement.appendChild(this.createCloseButton());
48 47
49 this._tabbedPane = new WebInspector.TabbedPane(); 48 this._tabbedPane = new WebInspector.TabbedPane();
50 this._tabbedPane.insertBeforeTabStrip(settingsLabelElement); 49 this._tabbedPane.insertBeforeTabStrip(settingsLabelElement);
51 this._tabbedPane.setShrinkableTabs(false); 50 this._tabbedPane.setShrinkableTabs(false);
52 this._tabbedPane.setVerticalTabLayout(true); 51 this._tabbedPane.setVerticalTabLayout(true);
53 this._tabbedPane.appendTab("general", WebInspector.UIString("General"), new WebInspector.GenericSettingsTab()); 52 this._tabbedPane.appendTab("general", WebInspector.UIString("General"), new WebInspector.GenericSettingsTab());
54 this._tabbedPane.appendTab("workspace", WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab()); 53 this._tabbedPane.appendTab("workspace", WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab());
55 if (Runtime.experiments.supportEnabled()) 54 if (Runtime.experiments.supportEnabled())
56 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab()); 55 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab());
57 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view"); 56 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view");
58 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView()); 57 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView());
59 58
60 this.element.addEventListener("keydown", this._keyDown.bind(this), false); 59 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
61 this._developerModeCounter = 0; 60 this._developerModeCounter = 0;
61 this.setDefaultFocusedElement(this.contentElement);
62 } 62 }
63 63
64 WebInspector.SettingsScreen.prototype = { 64 WebInspector.SettingsScreen.prototype = {
65 /** 65 /**
66 * @override 66 * @override
67 */ 67 */
68 wasShown: function() 68 wasShown: function()
69 { 69 {
70 this._tabbedPane.selectTab("general"); 70 this._tabbedPane.selectTab("general");
71 this._tabbedPane.show(this._contentElement); 71 this._tabbedPane.show(this.contentElement);
72 WebInspector.HelpScreen.prototype.wasShown.call(this); 72 WebInspector.VBox.prototype.wasShown.call(this);
73 }, 73 },
74 74
75 /** 75 /**
76 * @param {string} name 76 * @param {string} name
77 */ 77 */
78 selectTab: function(name) 78 selectTab: function(name)
79 { 79 {
80 this._tabbedPane.selectTab(name); 80 this._tabbedPane.selectTab(name);
81 }, 81 },
82 82
83 /** 83 /**
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 84 * @param {!Event} event
106 */ 85 */
107 _keyDown: function(event) 86 _keyDown: function(event)
108 { 87 {
109 var shiftKeyCode = 16; 88 var shiftKeyCode = 16;
110 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5) 89 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5)
111 this.element.classList.add("settings-developer-mode"); 90 this.element.classList.add("settings-developer-mode");
112 }, 91 },
113 92
114 __proto__: WebInspector.HelpScreen.prototype 93 __proto__: WebInspector.VBox.prototype
115 } 94 }
116 95
117 /** 96 /**
118 * @constructor 97 * @constructor
119 * @extends {WebInspector.VBox} 98 * @extends {WebInspector.VBox}
120 * @param {string} name 99 * @param {string} name
121 * @param {string=} id 100 * @param {string=} id
122 */ 101 */
123 WebInspector.SettingsTab = function(name, id) 102 WebInspector.SettingsTab = function(name, id)
124 { 103 {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 __proto__: WebInspector.SettingsTab.prototype 532 __proto__: WebInspector.SettingsTab.prototype
554 } 533 }
555 534
556 /** 535 /**
557 * @constructor 536 * @constructor
558 */ 537 */
559 WebInspector.SettingsController = function() 538 WebInspector.SettingsController = function()
560 { 539 {
561 /** @type {?WebInspector.SettingsScreen} */ 540 /** @type {?WebInspector.SettingsScreen} */
562 this._settingsScreen; 541 this._settingsScreen;
563 this._resizeBound = this._resize.bind(this);
564 } 542 }
565 543
566 WebInspector.SettingsController.prototype = { 544 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 /** 545 /**
575 * @param {string=} name 546 * @param {string=} name
576 */ 547 */
577 showSettingsScreen: function(name) 548 showSettingsScreen: function(name)
578 { 549 {
579 if (!this._settingsScreen) 550 if (!this._settingsScreen)
580 this._settingsScreen = new WebInspector.SettingsScreen(this._onHideS ettingsScreen.bind(this)); 551 this._settingsScreen = new WebInspector.SettingsScreen();
581 this._settingsScreen.showModal(); 552
553 var dialog = new WebInspector.Dialog();
554 dialog.addCloseButton();
555 this._settingsScreen.show(dialog.element);
556 dialog.show();
557
582 if (name) 558 if (name)
583 this._settingsScreen.selectTab(name); 559 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 } 560 }
594 } 561 }
595 562
596 /** 563 /**
597 * @constructor 564 * @constructor
598 * @implements {WebInspector.ActionDelegate} 565 * @implements {WebInspector.ActionDelegate}
599 */ 566 */
600 WebInspector.SettingsController.ActionDelegate = function() { } 567 WebInspector.SettingsController.ActionDelegate = function() { }
601 568
602 WebInspector.SettingsController.ActionDelegate.prototype = { 569 WebInspector.SettingsController.ActionDelegate.prototype = {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 var columnId = columns[i]; 1134 var columnId = columns[i];
1168 var editElement = this._addInputElements.get(columnId); 1135 var editElement = this._addInputElements.get(columnId);
1169 this._setEditElementValue(editElement, ""); 1136 this._setEditElementValue(editElement, "");
1170 } 1137 }
1171 }, 1138 },
1172 1139
1173 __proto__: WebInspector.SettingsList.prototype 1140 __proto__: WebInspector.SettingsList.prototype
1174 } 1141 }
1175 1142
1176 WebInspector._settingsController = new WebInspector.SettingsController(); 1143 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698