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

Side by Side Diff: Source/devtools/front_end/DockController.js

Issue 146733002: [DevTools] Dock to left mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Made an experiment Created 6 years, 11 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
« no previous file with comments | « no previous file | Source/devtools/front_end/ElementsPanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 24 matching lines...) Expand all
35 WebInspector.DockController = function() 35 WebInspector.DockController = function()
36 { 36 {
37 if (!WebInspector.queryParamsObject["can_dock"]) { 37 if (!WebInspector.queryParamsObject["can_dock"]) {
38 this._dockSide = WebInspector.DockController.State.Undocked; 38 this._dockSide = WebInspector.DockController.State.Undocked;
39 this._updateUI(); 39 this._updateUI();
40 return; 40 return;
41 } 41 }
42 42
43 WebInspector.settings.currentDockState = WebInspector.settings.createSetting ("currentDockState", ""); 43 WebInspector.settings.currentDockState = WebInspector.settings.createSetting ("currentDockState", "");
44 WebInspector.settings.lastDockState = WebInspector.settings.createSetting("l astDockState", ""); 44 WebInspector.settings.lastDockState = WebInspector.settings.createSetting("l astDockState", "");
45 var states = [WebInspector.DockController.State.DockedToBottom, WebInspector .DockController.State.Undocked, WebInspector.DockController.State.DockedToRight] ;
46 var titles = [WebInspector.UIString("Dock to main window."), WebInspector.UI String("Undock into separate window."), WebInspector.UIString("Dock to main wind ow.")];
47 if (WebInspector.experimentsSettings.dockToLeft.isEnabled()) {
48 states.push(WebInspector.DockController.State.DockedToLeft);
49 titles.push(WebInspector.UIString("Dock to main window."));
50 }
45 this._dockToggleButton = new WebInspector.StatusBarStatesSettingButton( 51 this._dockToggleButton = new WebInspector.StatusBarStatesSettingButton(
46 "dock-status-bar-item", 52 "dock-status-bar-item",
47 [WebInspector.DockController.State.DockedToBottom, WebInspector.DockCont roller.State.Undocked, WebInspector.DockController.State.DockedToRight], 53 states,
48 [WebInspector.UIString("Dock to main window."), WebInspector.UIString("U ndock into separate window."), WebInspector.UIString("Dock to main window.")], 54 titles,
49 WebInspector.settings.currentDockState, 55 WebInspector.settings.currentDockState,
50 WebInspector.settings.lastDockState, 56 WebInspector.settings.lastDockState,
51 this._dockSideChanged.bind(this)); 57 this._dockSideChanged.bind(this));
52 } 58 }
53 59
54 WebInspector.DockController.State = { 60 WebInspector.DockController.State = {
55 DockedToBottom: "bottom", 61 DockedToBottom: "bottom",
56 DockedToRight: "right", 62 DockedToRight: "right",
63 DockedToLeft: "left",
57 Undocked: "undocked" 64 Undocked: "undocked"
58 } 65 }
59 66
60 WebInspector.DockController.Events = { 67 WebInspector.DockController.Events = {
61 DockSideChanged: "DockSideChanged" 68 DockSideChanged: "DockSideChanged"
62 } 69 }
63 70
64 WebInspector.DockController.prototype = { 71 WebInspector.DockController.prototype = {
65 /** 72 /**
66 * @return {?Element} 73 * @return {?Element}
67 */ 74 */
68 get element() 75 get element()
69 { 76 {
70 return WebInspector.queryParamsObject["can_dock"] ? this._dockToggleButt on.element : null; 77 return WebInspector.queryParamsObject["can_dock"] ? this._dockToggleButt on.element : null;
71 }, 78 },
72 79
73 /** 80 /**
74 * @return {string} 81 * @return {string}
75 */ 82 */
76 dockSide: function() 83 dockSide: function()
77 { 84 {
78 return this._dockSide; 85 return this._dockSide;
79 }, 86 },
80 87
81 /** 88 /**
89 * @return {boolean}
90 */
91 isVertical: function()
92 {
93 return this._dockSide === WebInspector.DockController.State.DockedToRigh t || this._dockSide === WebInspector.DockController.State.DockedToLeft;
94 },
95
96 /**
82 * @param {string} dockSide 97 * @param {string} dockSide
83 */ 98 */
84 _dockSideChanged: function(dockSide) 99 _dockSideChanged: function(dockSide)
85 { 100 {
86 if (this._dockSide === dockSide) 101 if (this._dockSide === dockSide)
87 return; 102 return;
88 103
89 this._dockSide = dockSide; 104 this._dockSide = dockSide;
90 if (WebInspector.queryParamsObject["can_dock"]) 105 if (WebInspector.queryParamsObject["can_dock"])
91 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockCont roller.State.Undocked); 106 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockCont roller.State.Undocked);
92 107
93 this._updateUI(); 108 this._updateUI();
94 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid eChanged, this._dockSide); 109 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid eChanged, this._dockSide);
95 }, 110 },
96 111
97 _updateUI: function() 112 _updateUI: function()
98 { 113 {
99 var body = document.body; 114 var body = document.body;
100 switch (this._dockSide) { 115 switch (this._dockSide) {
101 case WebInspector.DockController.State.DockedToBottom: 116 case WebInspector.DockController.State.DockedToBottom:
102 body.classList.remove("undocked"); 117 body.classList.remove("undocked");
103 body.classList.remove("dock-to-right"); 118 body.classList.remove("dock-to-right");
119 body.classList.remove("dock-to-left");
104 body.classList.add("dock-to-bottom"); 120 body.classList.add("dock-to-bottom");
105 break; 121 break;
106 case WebInspector.DockController.State.DockedToRight: 122 case WebInspector.DockController.State.DockedToRight:
107 body.classList.remove("undocked"); 123 body.classList.remove("undocked");
108 body.classList.add("dock-to-right"); 124 body.classList.add("dock-to-right");
125 body.classList.remove("dock-to-left");
109 body.classList.remove("dock-to-bottom"); 126 body.classList.remove("dock-to-bottom");
110 break; 127 break;
111 case WebInspector.DockController.State.Undocked: 128 case WebInspector.DockController.State.DockedToLeft:
129 body.classList.remove("undocked");
130 body.classList.remove("dock-to-right");
131 body.classList.add("dock-to-left");
132 body.classList.remove("dock-to-bottom");
133 break;
134 case WebInspector.DockController.State.Undocked:
112 body.classList.add("undocked"); 135 body.classList.add("undocked");
113 body.classList.remove("dock-to-right"); 136 body.classList.remove("dock-to-right");
137 body.classList.remove("dock-to-left");
114 body.classList.remove("dock-to-bottom"); 138 body.classList.remove("dock-to-bottom");
115 break; 139 break;
116 } 140 }
117 }, 141 },
118 142
119 __proto__: WebInspector.Object.prototype 143 __proto__: WebInspector.Object.prototype
120 } 144 }
121 145
122 /** 146 /**
123 * @type {!WebInspector.DockController} 147 * @type {!WebInspector.DockController}
124 */ 148 */
125 WebInspector.dockController; 149 WebInspector.dockController;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ElementsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698