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

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: rebased 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 this._tabbedPane.appendTab("blackbox", WebInspector.manageBlackboxingSetting sTabLabel(), new WebInspector.FrameworkBlackboxSettingsTab()); 53 this._tabbedPane.appendTab("blackbox", WebInspector.manageBlackboxingSetting sTabLabel(), new WebInspector.FrameworkBlackboxSettingsTab());
56 if (Runtime.experiments.supportEnabled()) 54 if (Runtime.experiments.supportEnabled())
57 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab()); 55 this._tabbedPane.appendTab("experiments", WebInspector.UIString("Experim ents"), new WebInspector.ExperimentsSettingsTab());
58 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view"); 56 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "settings-view");
59 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView()); 57 this._tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView());
60 58
61 this.element.addEventListener("keydown", this._keyDown.bind(this), false); 59 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
62 this._developerModeCounter = 0; 60 this._developerModeCounter = 0;
61 this.setDefaultFocusedElement(this.contentElement);
63 } 62 }
64 63
65 WebInspector.SettingsScreen.prototype = { 64 WebInspector.SettingsScreen.prototype = {
66 /** 65 /**
67 * @override 66 * @override
68 */ 67 */
69 wasShown: function() 68 wasShown: function()
70 { 69 {
71 this._tabbedPane.selectTab("general"); 70 this._tabbedPane.selectTab("general");
72 this._tabbedPane.show(this._contentElement); 71 this._tabbedPane.show(this.contentElement);
73 WebInspector.HelpScreen.prototype.wasShown.call(this); 72 WebInspector.VBox.prototype.wasShown.call(this);
74 }, 73 },
75 74
76 /** 75 /**
77 * @param {string} name 76 * @param {string} name
78 */ 77 */
79 selectTab: function(name) 78 selectTab: function(name)
80 { 79 {
81 this._tabbedPane.selectTab(name); 80 this._tabbedPane.selectTab(name);
82 }, 81 },
83 82
84 /** 83 /**
85 * @override
86 * @return {boolean}
87 */
88 isClosingKey: function(keyCode)
89 {
90 return [
91 WebInspector.KeyboardShortcut.Keys.Enter.code,
92 WebInspector.KeyboardShortcut.Keys.Esc.code,
93 ].indexOf(keyCode) >= 0;
94 },
95
96 /**
97 * @override
98 */
99 willHide: function()
100 {
101 this._onHide();
102 WebInspector.HelpScreen.prototype.willHide.call(this);
103 },
104
105 /**
106 * @param {!Event} event 84 * @param {!Event} event
107 */ 85 */
108 _keyDown: function(event) 86 _keyDown: function(event)
109 { 87 {
110 var shiftKeyCode = 16; 88 var shiftKeyCode = 16;
111 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5) 89 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5)
112 this.element.classList.add("settings-developer-mode"); 90 this.element.classList.add("settings-developer-mode");
113 }, 91 },
114 92
115 __proto__: WebInspector.HelpScreen.prototype 93 __proto__: WebInspector.VBox.prototype
116 } 94 }
117 95
118 /** 96 /**
119 * @constructor 97 * @constructor
120 * @extends {WebInspector.VBox} 98 * @extends {WebInspector.VBox}
121 * @param {string} name 99 * @param {string} name
122 * @param {string=} id 100 * @param {string=} id
123 */ 101 */
124 WebInspector.SettingsTab = function(name, id) 102 WebInspector.SettingsTab = function(name, id)
125 { 103 {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 __proto__: WebInspector.SettingsTab.prototype 458 __proto__: WebInspector.SettingsTab.prototype
481 } 459 }
482 460
483 /** 461 /**
484 * @constructor 462 * @constructor
485 */ 463 */
486 WebInspector.SettingsController = function() 464 WebInspector.SettingsController = function()
487 { 465 {
488 /** @type {?WebInspector.SettingsScreen} */ 466 /** @type {?WebInspector.SettingsScreen} */
489 this._settingsScreen; 467 this._settingsScreen;
490 this._resizeBound = this._resize.bind(this);
491 } 468 }
492 469
493 WebInspector.SettingsController.prototype = { 470 WebInspector.SettingsController.prototype = {
494 _onHideSettingsScreen: function()
495 {
496 var window = this._settingsScreen.element.ownerDocument.defaultView;
497 window.removeEventListener("resize", this._resizeBound, false);
498 delete this._settingsScreenVisible;
499 },
500
501 /** 471 /**
502 * @param {string=} name 472 * @param {string=} name
503 */ 473 */
504 showSettingsScreen: function(name) 474 showSettingsScreen: function(name)
505 { 475 {
506 if (!this._settingsScreen) 476 if (!this._settingsScreen)
507 this._settingsScreen = new WebInspector.SettingsScreen(this._onHideS ettingsScreen.bind(this)); 477 this._settingsScreen = new WebInspector.SettingsScreen();
508 this._settingsScreen.showModal(); 478
479 var dialog = new WebInspector.Dialog();
480 dialog.addCloseButton();
481 this._settingsScreen.show(dialog.element);
482 dialog.show();
483
509 if (name) 484 if (name)
510 this._settingsScreen.selectTab(name); 485 this._settingsScreen.selectTab(name);
511 this._settingsScreenVisible = true;
512 var window = this._settingsScreen.element.ownerDocument.defaultView;
513 window.addEventListener("resize", this._resizeBound, false);
514 },
515
516 _resize: function()
517 {
518 if (this._settingsScreen && this._settingsScreen.isShowing())
519 this._settingsScreen.doResize();
520 } 486 }
521 } 487 }
522 488
523 /** 489 /**
524 * @constructor 490 * @constructor
525 * @implements {WebInspector.ActionDelegate} 491 * @implements {WebInspector.ActionDelegate}
526 */ 492 */
527 WebInspector.SettingsController.ActionDelegate = function() { } 493 WebInspector.SettingsController.ActionDelegate = function() { }
528 494
529 WebInspector.SettingsController.ActionDelegate.prototype = { 495 WebInspector.SettingsController.ActionDelegate.prototype = {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 var columnId = columns[i]; 1067 var columnId = columns[i];
1102 var editElement = this._addInputElements.get(columnId); 1068 var editElement = this._addInputElements.get(columnId);
1103 this._setEditElementValue(editElement, ""); 1069 this._setEditElementValue(editElement, "");
1104 } 1070 }
1105 }, 1071 },
1106 1072
1107 __proto__: WebInspector.SettingsList.prototype 1073 __proto__: WebInspector.SettingsList.prototype
1108 } 1074 }
1109 1075
1110 WebInspector._settingsController = new WebInspector.SettingsController(); 1076 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698