| 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.Object} | 33 * @extends {WebInspector.Object} |
| 34 * @param {boolean} canDock | 34 * @param {boolean} canDock |
| 35 */ | 35 */ |
| 36 WebInspector.DockController = function(canDock) | 36 WebInspector.DockController = function(canDock) |
| 37 { | 37 { |
| 38 this._canDock = canDock; | 38 this._canDock = canDock; |
| 39 |
| 40 this._closeButton = new WebInspector.ToolbarButton(WebInspector.UIString("Cl
ose"), "delete-toolbar-item"); |
| 41 this._closeButton.addEventListener("click", InspectorFrontendHost.closeWindo
w.bind(InspectorFrontendHost)); |
| 42 |
| 39 if (!canDock) { | 43 if (!canDock) { |
| 40 this._dockSide = WebInspector.DockController.State.Undocked; | 44 this._dockSide = WebInspector.DockController.State.Undocked; |
| 41 this._updateUI(); | 45 this._updateUI(); |
| 42 return; | 46 return; |
| 43 } | 47 } |
| 44 | 48 |
| 45 this._currentDockStateSetting = WebInspector.settings.createSetting("current
DockState", ""); | 49 this._currentDockStateSetting = WebInspector.settings.createSetting("current
DockState", ""); |
| 46 this._lastDockStateSetting = WebInspector.settings.createSetting("lastDockSt
ate", ""); | 50 this._lastDockStateSetting = WebInspector.settings.createSetting("lastDockSt
ate", ""); |
| 47 | 51 |
| 48 /** @type {!WebInspector.ToolbarStatesSettingButton|undefined} */ | 52 /** @type {!WebInspector.ToolbarStatesSettingButton|undefined} */ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 body.classList.remove("undocked"); | 150 body.classList.remove("undocked"); |
| 147 body.classList.add("dock-to-right"); | 151 body.classList.add("dock-to-right"); |
| 148 body.classList.remove("dock-to-bottom"); | 152 body.classList.remove("dock-to-bottom"); |
| 149 break; | 153 break; |
| 150 case WebInspector.DockController.State.Undocked: | 154 case WebInspector.DockController.State.Undocked: |
| 151 body.classList.add("undocked"); | 155 body.classList.add("undocked"); |
| 152 body.classList.remove("dock-to-right"); | 156 body.classList.remove("dock-to-right"); |
| 153 body.classList.remove("dock-to-bottom"); | 157 body.classList.remove("dock-to-bottom"); |
| 154 break; | 158 break; |
| 155 } | 159 } |
| 160 this._closeButton.setVisible(this._dockSide !== WebInspector.DockControl
ler.State.Undocked); |
| 156 }, | 161 }, |
| 157 | 162 |
| 158 __proto__: WebInspector.Object.prototype | 163 __proto__: WebInspector.Object.prototype |
| 159 } | 164 } |
| 160 | 165 |
| 161 /** | 166 /** |
| 162 * @constructor | 167 * @constructor |
| 163 * @implements {WebInspector.ToolbarItem.Provider} | 168 * @implements {WebInspector.ToolbarItem.Provider} |
| 164 */ | 169 */ |
| 165 WebInspector.DockController.ButtonProvider = function() | 170 WebInspector.DockController.ButtonProvider = function() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 handleAction: function(context, actionId) | 212 handleAction: function(context, actionId) |
| 208 { | 213 { |
| 209 var toggleButton = new WebInspector.DockController.ButtonProvider().item
(); | 214 var toggleButton = new WebInspector.DockController.ButtonProvider().item
(); |
| 210 if (!toggleButton || !toggleButton.enabled()) | 215 if (!toggleButton || !toggleButton.enabled()) |
| 211 return; | 216 return; |
| 212 /** @type {!WebInspector.ToolbarStatesSettingButton} */ (toggleButton).t
oggle(); | 217 /** @type {!WebInspector.ToolbarStatesSettingButton} */ (toggleButton).t
oggle(); |
| 213 } | 218 } |
| 214 } | 219 } |
| 215 | 220 |
| 216 /** | 221 /** |
| 222 * @constructor |
| 223 * @implements {WebInspector.ToolbarItem.Provider} |
| 224 */ |
| 225 WebInspector.DockController.CloseButtonProvider = function() |
| 226 { |
| 227 } |
| 228 |
| 229 WebInspector.DockController.CloseButtonProvider.prototype = { |
| 230 /** |
| 231 * @override |
| 232 * @return {?WebInspector.ToolbarItem} |
| 233 */ |
| 234 item: function() |
| 235 { |
| 236 return WebInspector.dockController._closeButton; |
| 237 } |
| 238 } |
| 239 |
| 240 /** |
| 217 * @type {!WebInspector.DockController} | 241 * @type {!WebInspector.DockController} |
| 218 */ | 242 */ |
| 219 WebInspector.dockController; | 243 WebInspector.dockController; |
| OLD | NEW |