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

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: 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
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 26 matching lines...) Expand all
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 this._dockToggleButton = new WebInspector.StatusBarStatesSettingButton( 45 this._dockToggleButton = new WebInspector.StatusBarStatesSettingButton(
46 "dock-status-bar-item", 46 "dock-status-bar-item",
47 [WebInspector.DockController.State.DockedToBottom, WebInspector.DockCont roller.State.Undocked, WebInspector.DockController.State.DockedToRight], 47 [WebInspector.DockController.State.DockedToBottom, WebInspector.DockCont roller.State.Undocked, WebInspector.DockController.State.DockedToRight, WebInspe ctor.DockController.State.DockedToLeft],
48 [WebInspector.UIString("Dock to main window."), WebInspector.UIString("U ndock into separate window."), WebInspector.UIString("Dock to main window.")], 48 [WebInspector.UIString("Dock to main window."), WebInspector.UIString("U ndock into separate window."), WebInspector.UIString("Dock to main window."), We bInspector.UIString("Dock to main window.")],
49 WebInspector.settings.currentDockState, 49 WebInspector.settings.currentDockState,
50 WebInspector.settings.lastDockState, 50 WebInspector.settings.lastDockState,
51 this._dockSideChanged.bind(this)); 51 this._dockSideChanged.bind(this));
52 } 52 }
53 53
54 WebInspector.DockController.State = { 54 WebInspector.DockController.State = {
55 DockedToBottom: "bottom", 55 DockedToBottom: "bottom",
56 DockedToRight: "right", 56 DockedToRight: "right",
57 DockedToLeft: "left",
57 Undocked: "undocked" 58 Undocked: "undocked"
58 } 59 }
59 60
60 WebInspector.DockController.Events = { 61 WebInspector.DockController.Events = {
61 DockSideChanged: "DockSideChanged" 62 DockSideChanged: "DockSideChanged"
62 } 63 }
63 64
64 WebInspector.DockController.prototype = { 65 WebInspector.DockController.prototype = {
65 /** 66 /**
66 * @return {?Element} 67 * @return {?Element}
67 */ 68 */
68 get element() 69 get element()
69 { 70 {
70 return WebInspector.queryParamsObject["can_dock"] ? this._dockToggleButt on.element : null; 71 return WebInspector.queryParamsObject["can_dock"] ? this._dockToggleButt on.element : null;
71 }, 72 },
72 73
73 /** 74 /**
74 * @return {string} 75 * @return {string}
75 */ 76 */
76 dockSide: function() 77 dockSide: function()
77 { 78 {
78 return this._dockSide; 79 return this._dockSide;
79 }, 80 },
80 81
81 /** 82 /**
83 * @return {boolean}
84 */
85 isVertical: function()
86 {
87 return this._dockSide === WebInspector.DockController.State.DockedToRigh t || this._dockSide === WebInspector.DockController.State.DockedToLeft;
88 },
89
90 /**
82 * @param {string} dockSide 91 * @param {string} dockSide
83 */ 92 */
84 _dockSideChanged: function(dockSide) 93 _dockSideChanged: function(dockSide)
85 { 94 {
86 if (this._dockSide === dockSide) 95 if (this._dockSide === dockSide)
87 return; 96 return;
88 97
89 this._dockSide = dockSide; 98 this._dockSide = dockSide;
90 if (WebInspector.queryParamsObject["can_dock"]) 99 if (WebInspector.queryParamsObject["can_dock"])
91 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockCont roller.State.Undocked); 100 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockCont roller.State.Undocked);
92 101
93 this._updateUI(); 102 this._updateUI();
94 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid eChanged, this._dockSide); 103 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid eChanged, this._dockSide);
95 }, 104 },
96 105
97 _updateUI: function() 106 _updateUI: function()
98 { 107 {
99 var body = document.body; 108 var body = document.body;
100 switch (this._dockSide) { 109 switch (this._dockSide) {
101 case WebInspector.DockController.State.DockedToBottom: 110 case WebInspector.DockController.State.DockedToBottom:
102 body.classList.remove("undocked"); 111 body.classList.remove("undocked");
103 body.classList.remove("dock-to-right"); 112 body.classList.remove("dock-to-right");
113 body.classList.remove("dock-to-left");
104 body.classList.add("dock-to-bottom"); 114 body.classList.add("dock-to-bottom");
105 break; 115 break;
106 case WebInspector.DockController.State.DockedToRight: 116 case WebInspector.DockController.State.DockedToRight:
107 body.classList.remove("undocked"); 117 body.classList.remove("undocked");
108 body.classList.add("dock-to-right"); 118 body.classList.add("dock-to-right");
119 body.classList.remove("dock-to-left");
109 body.classList.remove("dock-to-bottom"); 120 body.classList.remove("dock-to-bottom");
110 break; 121 break;
111 case WebInspector.DockController.State.Undocked: 122 case WebInspector.DockController.State.DockedToLeft:
123 body.classList.remove("undocked");
124 body.classList.remove("dock-to-right");
125 body.classList.add("dock-to-left");
126 body.classList.remove("dock-to-bottom");
127 break;
128 case WebInspector.DockController.State.Undocked:
112 body.classList.add("undocked"); 129 body.classList.add("undocked");
113 body.classList.remove("dock-to-right"); 130 body.classList.remove("dock-to-right");
131 body.classList.remove("dock-to-left");
114 body.classList.remove("dock-to-bottom"); 132 body.classList.remove("dock-to-bottom");
115 break; 133 break;
116 } 134 }
117 }, 135 },
118 136
119 __proto__: WebInspector.Object.prototype 137 __proto__: WebInspector.Object.prototype
120 } 138 }
121 139
122 /** 140 /**
123 * @type {!WebInspector.DockController} 141 * @type {!WebInspector.DockController}
124 */ 142 */
125 WebInspector.dockController; 143 WebInspector.dockController;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ElementsPanel.js » ('j') | Source/devtools/front_end/InspectorView.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698