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

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

Issue 2204303003: DevTools: encapsulate extensible tabbed widget into the view manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 4 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 26 matching lines...) Expand all
37 { 37 {
38 WebInspector.VBox.call(this, true); 38 WebInspector.VBox.call(this, true);
39 this.registerRequiredCSS("settings/settingsScreen.css"); 39 this.registerRequiredCSS("settings/settingsScreen.css");
40 40
41 this.contentElement.tabIndex = 0; 41 this.contentElement.tabIndex = 0;
42 this.contentElement.classList.add("help-window-main"); 42 this.contentElement.classList.add("help-window-main");
43 this.contentElement.classList.add("vbox"); 43 this.contentElement.classList.add("vbox");
44 var settingsLabelElement = createElementWithClass("div", "help-window-label" ); 44 var settingsLabelElement = createElementWithClass("div", "help-window-label" );
45 settingsLabelElement.createTextChild(WebInspector.UIString("Settings")); 45 settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));
46 46
47 this._extensibleTabbedPane = new WebInspector.ExtensibleTabbedPane("settings -view"); 47 this._tabbedLocation = WebInspector.viewManager.createTabbedLocation("settin gs-view");
48 var tabbedPane = this._extensibleTabbedPane.tabbedPane(); 48 var tabbedPane = this._tabbedLocation.tabbedPane();
49 tabbedPane.insertBeforeTabStrip(settingsLabelElement); 49 tabbedPane.insertBeforeTabStrip(settingsLabelElement);
50 tabbedPane.setShrinkableTabs(false); 50 tabbedPane.setShrinkableTabs(false);
51 tabbedPane.setVerticalTabLayout(true); 51 tabbedPane.setVerticalTabLayout(true);
52 tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebIns pector.shortcutsScreen.createShortcutsTabView()); 52 tabbedPane.appendTab("shortcuts", WebInspector.UIString("Shortcuts"), WebIns pector.shortcutsScreen.createShortcutsTabView());
53 this._extensibleTabbedPane.show(this.contentElement); 53 tabbedPane.show(this.contentElement);
54 54
55 this.element.addEventListener("keydown", this._keyDown.bind(this), false); 55 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
56 this._developerModeCounter = 0; 56 this._developerModeCounter = 0;
57 this.setDefaultFocusedElement(this.contentElement); 57 this.setDefaultFocusedElement(this.contentElement);
58 } 58 }
59 59
60 /** 60 /**
61 * @param {string=} name 61 * @param {string=} name
62 */ 62 */
63 WebInspector.SettingsScreen._showSettingsScreen = function(name) 63 WebInspector.SettingsScreen._showSettingsScreen = function(name)
64 { 64 {
65 var settingsScreen = /** @type {!WebInspector.SettingsScreen} */ (self.runti me.sharedInstance(WebInspector.SettingsScreen)); 65 var settingsScreen = /** @type {!WebInspector.SettingsScreen} */ (self.runti me.sharedInstance(WebInspector.SettingsScreen));
66 var dialog = new WebInspector.Dialog(); 66 var dialog = new WebInspector.Dialog();
67 dialog.addCloseButton(); 67 dialog.addCloseButton();
68 settingsScreen.show(dialog.element); 68 settingsScreen.show(dialog.element);
69 settingsScreen.selectTab(name || "preferences"); 69 settingsScreen.selectTab(name || "preferences");
70 dialog.show(); 70 dialog.show();
71 } 71 }
72 72
73 WebInspector.SettingsScreen.prototype = { 73 WebInspector.SettingsScreen.prototype = {
74 74
75 /** 75 /**
76 * @override 76 * @override
77 * @param {string} locationName 77 * @param {string} locationName
78 * @return {?WebInspector.ViewLocation} 78 * @return {?WebInspector.ViewLocation}
79 */ 79 */
80 resolveLocation: function(locationName) 80 revealLocation: function(locationName)
81 { 81 {
82 WebInspector.SettingsScreen._showSettingsScreen(); 82 WebInspector.SettingsScreen._showSettingsScreen();
83 return this._extensibleTabbedPane; 83 return this._tabbedLocation;
84 }, 84 },
85 85
86 /** 86 /**
87 * @param {string} name 87 * @param {string} name
88 */ 88 */
89 selectTab: function(name) 89 selectTab: function(name)
90 { 90 {
91 this._extensibleTabbedPane.showView(name); 91 this._tabbedLocation.showView(name);
92 }, 92 },
93 93
94 /** 94 /**
95 * @param {!Event} event 95 * @param {!Event} event
96 */ 96 */
97 _keyDown: function(event) 97 _keyDown: function(event)
98 { 98 {
99 var shiftKeyCode = 16; 99 var shiftKeyCode = 16;
100 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5) 100 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5)
101 this.contentElement.classList.add("settings-developer-mode"); 101 this.contentElement.classList.add("settings-developer-mode");
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return; 571 return;
572 var settings = extension.descriptor()["settings"]; 572 var settings = extension.descriptor()["settings"];
573 if (settings && settings.indexOf(setting.name) !== -1) { 573 if (settings && settings.indexOf(setting.name) !== -1) {
574 InspectorFrontendHost.bringToFront(); 574 InspectorFrontendHost.bringToFront();
575 WebInspector.SettingsScreen._showSettingsScreen(extension.descri ptor()["id"]); 575 WebInspector.SettingsScreen._showSettingsScreen(extension.descri ptor()["id"]);
576 success = true; 576 success = true;
577 } 577 }
578 } 578 }
579 } 579 }
580 } 580 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698