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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 int num_panels() const { return panels_.size(); } | 48 int num_panels() const { return panels_.size(); } |
49 bool is_dragging_panel() const; | 49 bool is_dragging_panel() const; |
50 | 50 |
51 private: | 51 private: |
52 friend class PanelBrowserTest; | 52 friend class PanelBrowserTest; |
53 | 53 |
54 typedef std::vector<Panel*> Panels; | 54 typedef std::vector<Panel*> Panels; |
55 | 55 |
56 PanelManager(); | 56 PanelManager(); |
57 | 57 |
58 #if UNIT_TEST | |
59 Panels panels() { return panels_; } | |
jianli
2011/08/24 22:04:03
Please define it as:
const Panels& panels() cons
prasadt
2011/08/24 23:04:30
Done.
| |
60 #endif | |
61 | |
58 // Applies the new work area. This is called by OnDisplayChanged and the test | 62 // Applies the new work area. This is called by OnDisplayChanged and the test |
59 // code. | 63 // code. |
60 void SetWorkArea(const gfx::Rect& work_area); | 64 void SetWorkArea(const gfx::Rect& work_area); |
61 | 65 |
62 // Handles all the panels that're delayed to be removed. | 66 // Handles all the panels that're delayed to be removed. |
63 void DelayedRemove(); | 67 void DelayedRemove(); |
64 | 68 |
65 // Does the remove. Called from Remove and DelayedRemove. | 69 // Does the remove. Called from Remove and DelayedRemove. |
66 void DoRemove(Panel* panel); | 70 void DoRemove(Panel* panel); |
67 | 71 |
68 // Rearranges the positions of the panels starting from the given iterator. | 72 // Rearranges the positions of the panels starting from the given iterator. |
69 // This is called when the display space has been changed, i.e. working | 73 // This is called when the display space has been changed, i.e. working |
70 // area being changed or a panel being closed. | 74 // area being changed or a panel being closed. |
71 void Rearrange(Panels::iterator iter_to_start); | 75 void Rearrange(Panels::iterator iter_to_start); |
72 | 76 |
73 // Computes the bounds for next panel. | 77 // Computes the bounds for next panel. |
74 // |allow_size_change| is used to indicate if the panel size can be changed to | 78 // |allow_size_change| is used to indicate if the panel size can be changed to |
75 // fall within the size constraint, e.g., when the panel is created. | 79 // fall within the size constraint, e.g., when the panel is created. |
76 // Returns true if computed bounds are within the displayable area. | 80 // Returns true if computed bounds are within the displayable area. |
77 bool ComputeBoundsForNextPanel(gfx::Rect* bounds, bool allow_size_change); | 81 bool ComputeBoundsForNextPanel(gfx::Rect* bounds, bool allow_size_change); |
78 | 82 |
79 // Finds one panel to close so that we may have space for the new panel | 83 // Finds one panel to close so that we may have space for the new panel |
80 // created by |extension|. | 84 // created by |extension|. |
81 void FindAndClosePanelOnOverflow(const Extension* extension); | 85 void FindAndClosePanelOnOverflow(const Extension* extension); |
82 | 86 |
83 // Help functions to drag the given panel. | 87 // Help functions to drag the given panel. |
84 void DragLeft(); | 88 void DragLeft(); |
85 void DragRight(); | 89 void DragRight(); |
86 | 90 |
91 // Horizontal spacing between panels. Used for unit testing. | |
92 static int horizontal_spacing(); | |
93 | |
87 Panels panels_; | 94 Panels panels_; |
88 | 95 |
89 // Stores the panels that are pending to remove. We want to delay the removal | 96 // Stores the panels that are pending to remove. We want to delay the removal |
90 // when we're in the process of the dragging. | 97 // when we're in the process of the dragging. |
91 Panels panels_pending_to_remove_; | 98 Panels panels_pending_to_remove_; |
92 | 99 |
93 // Current work area used in computing the panel bounds. | 100 // Current work area used in computing the panel bounds. |
94 gfx::Rect work_area_; | 101 gfx::Rect work_area_; |
95 | 102 |
96 // Used in computing the bounds of the next panel. | 103 // Used in computing the bounds of the next panel. |
(...skipping 12 matching lines...) Expand all Loading... | |
109 | 116 |
110 // Bounds of the panel to drag. It is first set to the original bounds when | 117 // Bounds of the panel to drag. It is first set to the original bounds when |
111 // the dragging happens. Then it is updated to the position that will be set | 118 // the dragging happens. Then it is updated to the position that will be set |
112 // to when the dragging ends. | 119 // to when the dragging ends. |
113 gfx::Rect dragging_panel_bounds_; | 120 gfx::Rect dragging_panel_bounds_; |
114 | 121 |
115 DISALLOW_COPY_AND_ASSIGN(PanelManager); | 122 DISALLOW_COPY_AND_ASSIGN(PanelManager); |
116 }; | 123 }; |
117 | 124 |
118 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 125 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
OLD | NEW |