OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/panels/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Default width and height of a panel. | 22 // Default width and height of a panel. |
23 const int kPanelDefaultWidthPixels = 240; | 23 const int kPanelDefaultWidthPixels = 240; |
24 const int kPanelDefaultHeightPixels = 290; | 24 const int kPanelDefaultHeightPixels = 290; |
25 | 25 |
26 // Maxmium width and height of a panel based on the factor of the working | 26 // Maxmium width and height of a panel based on the factor of the working |
27 // area. | 27 // area. |
28 const double kPanelMaxWidthFactor = 1.0; | 28 const double kPanelMaxWidthFactor = 1.0; |
29 const double kPanelMaxHeightFactor = 0.5; | 29 const double kPanelMaxHeightFactor = 0.5; |
30 | 30 |
31 // Horizontal spacing between two panels. | |
32 const int kPanelsHorizontalSpacing = 4; | |
33 | |
34 // Single instance of PanelManager. | 31 // Single instance of PanelManager. |
35 scoped_ptr<PanelManager> panel_instance; | 32 scoped_ptr<PanelManager> panel_instance; |
36 } // namespace | 33 } // namespace |
37 | 34 |
38 // static | 35 // static |
39 PanelManager* PanelManager::GetInstance() { | 36 PanelManager* PanelManager::GetInstance() { |
40 if (!panel_instance.get()) { | 37 if (!panel_instance.get()) { |
41 panel_instance.reset(new PanelManager()); | 38 panel_instance.reset(new PanelManager()); |
42 } | 39 } |
43 return panel_instance.get(); | 40 return panel_instance.get(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 350 |
354 // Start from the bottom to avoid reshuffling. | 351 // Start from the bottom to avoid reshuffling. |
355 for (Panels::reverse_iterator iter = panels_.rbegin(); | 352 for (Panels::reverse_iterator iter = panels_.rbegin(); |
356 iter != panels_.rend(); ++iter) | 353 iter != panels_.rend(); ++iter) |
357 (*iter)->Close(); | 354 (*iter)->Close(); |
358 } | 355 } |
359 | 356 |
360 bool PanelManager::is_dragging_panel() const { | 357 bool PanelManager::is_dragging_panel() const { |
361 return dragging_panel_index_ != kInvalidPanelIndex; | 358 return dragging_panel_index_ != kInvalidPanelIndex; |
362 } | 359 } |
OLD | NEW |