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 18 matching lines...) Expand all Loading... |
29 const double kPanelMaxHeightFactor = 0.5; | 29 const double kPanelMaxHeightFactor = 0.5; |
30 | 30 |
31 // Horizontal spacing between two panels. | 31 // Horizontal spacing between two panels. |
32 const int kPanelsHorizontalSpacing = 4; | 32 const int kPanelsHorizontalSpacing = 4; |
33 | 33 |
34 // Single instance of PanelManager. | 34 // Single instance of PanelManager. |
35 scoped_ptr<PanelManager> panel_instance; | 35 scoped_ptr<PanelManager> panel_instance; |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 // static | 38 // static |
| 39 int PanelManager::horizontal_spacing() { |
| 40 return kPanelsHorizontalSpacing; |
| 41 } |
| 42 |
| 43 // static |
39 PanelManager* PanelManager::GetInstance() { | 44 PanelManager* PanelManager::GetInstance() { |
40 if (!panel_instance.get()) { | 45 if (!panel_instance.get()) { |
41 panel_instance.reset(new PanelManager()); | 46 panel_instance.reset(new PanelManager()); |
42 } | 47 } |
43 return panel_instance.get(); | 48 return panel_instance.get(); |
44 } | 49 } |
45 | 50 |
46 PanelManager::PanelManager() | 51 PanelManager::PanelManager() |
47 : max_width_(0), | 52 : max_width_(0), |
48 max_height_(0), | 53 max_height_(0), |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 358 |
354 // Start from the bottom to avoid reshuffling. | 359 // Start from the bottom to avoid reshuffling. |
355 for (Panels::reverse_iterator iter = panels_.rbegin(); | 360 for (Panels::reverse_iterator iter = panels_.rbegin(); |
356 iter != panels_.rend(); ++iter) | 361 iter != panels_.rend(); ++iter) |
357 (*iter)->Close(); | 362 (*iter)->Close(); |
358 } | 363 } |
359 | 364 |
360 bool PanelManager::is_dragging_panel() const { | 365 bool PanelManager::is_dragging_panel() const { |
361 return dragging_panel_index_ != kInvalidPanelIndex; | 366 return dragging_panel_index_ != kInvalidPanelIndex; |
362 } | 367 } |
OLD | NEW |