OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 this._states = [WebInspector.DockController.State.DockedToRight, WebInspecto
r.DockController.State.DockedToBottom, WebInspector.DockController.State.Undocke
d]; | 49 this._states = [WebInspector.DockController.State.DockedToRight, WebInspecto
r.DockController.State.DockedToBottom, WebInspector.DockController.State.Undocke
d]; |
50 this._currentDockStateSetting = WebInspector.settings.moduleSetting("current
DockState"); | 50 this._currentDockStateSetting = WebInspector.settings.moduleSetting("current
DockState"); |
51 this._currentDockStateSetting.addChangeListener(this._dockSideChanged, this)
; | 51 this._currentDockStateSetting.addChangeListener(this._dockSideChanged, this)
; |
52 this._lastDockStateSetting = WebInspector.settings.createSetting("lastDockSt
ate", "bottom"); | 52 this._lastDockStateSetting = WebInspector.settings.createSetting("lastDockSt
ate", "bottom"); |
53 if (this._states.indexOf(this._currentDockStateSetting.get()) === -1) | 53 if (this._states.indexOf(this._currentDockStateSetting.get()) === -1) |
54 this._currentDockStateSetting.set("right"); | 54 this._currentDockStateSetting.set("right"); |
55 if (this._states.indexOf(this._lastDockStateSetting.get()) === -1) | 55 if (this._states.indexOf(this._lastDockStateSetting.get()) === -1) |
56 this._currentDockStateSetting.set("bottom"); | 56 this._currentDockStateSetting.set("bottom"); |
57 } | 57 }; |
58 | 58 |
59 WebInspector.DockController.State = { | 59 WebInspector.DockController.State = { |
60 DockedToBottom: "bottom", | 60 DockedToBottom: "bottom", |
61 DockedToRight: "right", | 61 DockedToRight: "right", |
62 Undocked: "undocked" | 62 Undocked: "undocked" |
63 } | 63 }; |
64 | 64 |
65 // Use BeforeDockSideChanged to do something before all the UI bits are updated, | 65 // Use BeforeDockSideChanged to do something before all the UI bits are updated, |
66 // DockSideChanged to update UI, and AfterDockSideChanged to perform actions | 66 // DockSideChanged to update UI, and AfterDockSideChanged to perform actions |
67 // after frontend is docked/undocked in the browser. | 67 // after frontend is docked/undocked in the browser. |
68 | 68 |
69 /** @enum {symbol} */ | 69 /** @enum {symbol} */ |
70 WebInspector.DockController.Events = { | 70 WebInspector.DockController.Events = { |
71 BeforeDockSideChanged: Symbol("BeforeDockSideChanged"), | 71 BeforeDockSideChanged: Symbol("BeforeDockSideChanged"), |
72 DockSideChanged: Symbol("DockSideChanged"), | 72 DockSideChanged: Symbol("DockSideChanged"), |
73 AfterDockSideChanged: Symbol("AfterDockSideChanged") | 73 AfterDockSideChanged: Symbol("AfterDockSideChanged") |
74 } | 74 }; |
75 | 75 |
76 WebInspector.DockController.prototype = { | 76 WebInspector.DockController.prototype = { |
77 initialize: function() | 77 initialize: function() |
78 { | 78 { |
79 if (!this._canDock) | 79 if (!this._canDock) |
80 return; | 80 return; |
81 | 81 |
82 this._titles = [WebInspector.UIString("Dock to right"), WebInspector.UIS
tring("Dock to bottom"), WebInspector.UIString("Undock into separate window")]; | 82 this._titles = [WebInspector.UIString("Dock to right"), WebInspector.UIS
tring("Dock to bottom"), WebInspector.UIString("Undock into separate window")]; |
83 this._dockSideChanged(); | 83 this._dockSideChanged(); |
84 }, | 84 }, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 _toggleDockSide: function() | 179 _toggleDockSide: function() |
180 { | 180 { |
181 if (this._lastDockStateSetting.get() === this._currentDockStateSetting.g
et()) { | 181 if (this._lastDockStateSetting.get() === this._currentDockStateSetting.g
et()) { |
182 var index = this._states.indexOf(this._currentDockStateSetting.get()
) || 0; | 182 var index = this._states.indexOf(this._currentDockStateSetting.get()
) || 0; |
183 this._lastDockStateSetting.set(this._states[(index + 1) % this._stat
es.length]); | 183 this._lastDockStateSetting.set(this._states[(index + 1) % this._stat
es.length]); |
184 } | 184 } |
185 this.setDockSide(this._lastDockStateSetting.get()); | 185 this.setDockSide(this._lastDockStateSetting.get()); |
186 }, | 186 }, |
187 | 187 |
188 __proto__: WebInspector.Object.prototype | 188 __proto__: WebInspector.Object.prototype |
189 } | 189 }; |
190 | 190 |
191 /** | 191 /** |
192 * @constructor | 192 * @constructor |
193 * @implements {WebInspector.ActionDelegate} | 193 * @implements {WebInspector.ActionDelegate} |
194 */ | 194 */ |
195 WebInspector.DockController.ToggleDockActionDelegate = function() | 195 WebInspector.DockController.ToggleDockActionDelegate = function() |
196 { | 196 { |
197 } | 197 }; |
198 | 198 |
199 WebInspector.DockController.ToggleDockActionDelegate.prototype = { | 199 WebInspector.DockController.ToggleDockActionDelegate.prototype = { |
200 /** | 200 /** |
201 * @override | 201 * @override |
202 * @param {!WebInspector.Context} context | 202 * @param {!WebInspector.Context} context |
203 * @param {string} actionId | 203 * @param {string} actionId |
204 * @return {boolean} | 204 * @return {boolean} |
205 */ | 205 */ |
206 handleAction: function(context, actionId) | 206 handleAction: function(context, actionId) |
207 { | 207 { |
208 WebInspector.dockController._toggleDockSide(); | 208 WebInspector.dockController._toggleDockSide(); |
209 return true; | 209 return true; |
210 } | 210 } |
211 } | 211 }; |
212 | 212 |
213 /** | 213 /** |
214 * @constructor | 214 * @constructor |
215 * @implements {WebInspector.ToolbarItem.Provider} | 215 * @implements {WebInspector.ToolbarItem.Provider} |
216 */ | 216 */ |
217 WebInspector.DockController.CloseButtonProvider = function() | 217 WebInspector.DockController.CloseButtonProvider = function() |
218 { | 218 { |
219 } | 219 }; |
220 | 220 |
221 WebInspector.DockController.CloseButtonProvider.prototype = { | 221 WebInspector.DockController.CloseButtonProvider.prototype = { |
222 /** | 222 /** |
223 * @override | 223 * @override |
224 * @return {?WebInspector.ToolbarItem} | 224 * @return {?WebInspector.ToolbarItem} |
225 */ | 225 */ |
226 item: function() | 226 item: function() |
227 { | 227 { |
228 return WebInspector.dockController._closeButton; | 228 return WebInspector.dockController._closeButton; |
229 } | 229 } |
230 } | 230 }; |
231 | 231 |
232 /** | 232 /** |
233 * @type {!WebInspector.DockController} | 233 * @type {!WebInspector.DockController} |
234 */ | 234 */ |
235 WebInspector.dockController; | 235 WebInspector.dockController; |
OLD | NEW |