| 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_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 int GetMaxPanelWidth() const; | 75 int GetMaxPanelWidth() const; |
| 76 int GetMaxPanelHeight() const; | 76 int GetMaxPanelHeight() const; |
| 77 int StartingRightPosition() const; | 77 int StartingRightPosition() const; |
| 78 | 78 |
| 79 void OnAutoHidingDesktopBarVisibilityChanged( | 79 void OnAutoHidingDesktopBarVisibilityChanged( |
| 80 AutoHidingDesktopBar::Alignment alignment, | 80 AutoHidingDesktopBar::Alignment alignment, |
| 81 AutoHidingDesktopBar::Visibility visibility); | 81 AutoHidingDesktopBar::Visibility visibility); |
| 82 | 82 |
| 83 void OnFullScreenModeChanged(bool is_full_screen); | 83 void OnFullScreenModeChanged(bool is_full_screen); |
| 84 | 84 |
| 85 #ifdef UNIT_TEST | |
| 86 static int horizontal_spacing() { return kPanelsHorizontalSpacing; } | |
| 87 | |
| 88 void remove_delays_for_testing() { | |
| 89 remove_delays_for_testing_ = true; | |
| 90 } | |
| 91 | |
| 92 int minimized_panel_count() { | |
| 93 return minimized_panel_count_; | |
| 94 } | |
| 95 #endif | |
| 96 | |
| 97 private: | 85 private: |
| 98 enum TitlebarAction { | 86 enum TitlebarAction { |
| 99 NO_ACTION, | 87 NO_ACTION, |
| 100 BRING_UP, | 88 BRING_UP, |
| 101 BRING_DOWN | 89 BRING_DOWN |
| 102 }; | 90 }; |
| 103 | 91 |
| 104 // Overridden from PanelMouseWatcherObserver: | 92 // Overridden from PanelMouseWatcherObserver: |
| 105 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; | 93 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; |
| 106 | 94 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 void DragRight(); | 115 void DragRight(); |
| 128 | 116 |
| 129 // Does the real job of bringing up or down the titlebars. | 117 // Does the real job of bringing up or down the titlebars. |
| 130 void DoBringUpOrDownTitlebars(bool bring_up); | 118 void DoBringUpOrDownTitlebars(bool bring_up); |
| 131 // The callback for a delyed task, checks if it still need to perform | 119 // The callback for a delyed task, checks if it still need to perform |
| 132 // the delayed action. | 120 // the delayed action. |
| 133 void DelayedBringUpOrDownTitlebarsCheck(); | 121 void DelayedBringUpOrDownTitlebarsCheck(); |
| 134 | 122 |
| 135 int GetRightMostAvailablePosition() const; | 123 int GetRightMostAvailablePosition() const; |
| 136 | 124 |
| 137 // Moves the panel from the panel strip to the overflow area because | 125 // Called by AddPanel() after a delay to move a newly created panel from |
| 138 // the panel will not fit within the bounds of the panel strip. | 126 // the panel strip to the overflow area because the panel could not fit |
| 139 // Overflow may occur when new panels are added, the bounds of the strip | 127 // within the bounds of the panel strip. New panels are first displayed |
| 140 // changes, a panel's size grows, a panel is moved from overflow into | 128 // in the panel strip, even if it would overflow, then moved to the overflow |
| 141 // the strip, etc. | 129 // area so that all created panels are (at least briefly) visible to the user |
| 142 void MovePanelToOverflow(Panel* panel, bool is_new); | 130 // before entering overflow. |
| 143 | 131 void MovePanelToOverflowAfterDelay(Panel* panel); |
| 144 // Moves panels to the overflow area, starting from the last panel. | |
| 145 // |overflow_point| is the index of the first panel to oveflow. | |
| 146 void MovePanelsToOverflow(size_t overflow_point); | |
| 147 | |
| 148 // Adds zero or more panels from overflow as will fit in the panel strip. | |
| 149 void MovePanelsFromOverflowIfNeeded(); | |
| 150 | 132 |
| 151 PanelManager* panel_manager_; // Weak, owns us. | 133 PanelManager* panel_manager_; // Weak, owns us. |
| 152 | 134 |
| 153 // All panels in the panel strip must fit within this area. | 135 // All panels in the panel strip must fit within this area. |
| 154 gfx::Rect display_area_; | 136 gfx::Rect display_area_; |
| 155 | 137 |
| 156 Panels panels_; | 138 Panels panels_; |
| 157 | 139 |
| 158 // Stores the panels that are pending to remove. We want to delay the removal | 140 // Stores the panels that are pending to remove. We want to delay the removal |
| 159 // when we're in the process of the dragging. | 141 // when we're in the process of the dragging. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 170 int dragging_panel_original_x_; | 152 int dragging_panel_original_x_; |
| 171 | 153 |
| 172 // Bounds of the panel to drag. It is first set to the original bounds when | 154 // Bounds of the panel to drag. It is first set to the original bounds when |
| 173 // the dragging happens. Then it is updated to the position that will be set | 155 // the dragging happens. Then it is updated to the position that will be set |
| 174 // to when the dragging ends. | 156 // to when the dragging ends. |
| 175 gfx::Rect dragging_panel_bounds_; | 157 gfx::Rect dragging_panel_bounds_; |
| 176 | 158 |
| 177 // Delayed transitions support. Sometimes transitions between minimized and | 159 // Delayed transitions support. Sometimes transitions between minimized and |
| 178 // title-only states are delayed, for better usability with Taskbars/Docks. | 160 // title-only states are delayed, for better usability with Taskbars/Docks. |
| 179 TitlebarAction delayed_titlebar_action_; | 161 TitlebarAction delayed_titlebar_action_; |
| 180 bool remove_delays_for_testing_; | 162 |
| 181 // Owned by MessageLoop after posting. | 163 // Owned by MessageLoop after posting. |
| 182 base::WeakPtrFactory<PanelStrip> titlebar_action_factory_; | 164 base::WeakPtrFactory<PanelStrip> titlebar_action_factory_; |
| 183 | 165 |
| 184 static const int kPanelsHorizontalSpacing = 4; | 166 static const int kPanelsHorizontalSpacing = 4; |
| 185 | 167 |
| 186 // Absolute minimum width and height for panels, including non-client area. | 168 // Absolute minimum width and height for panels, including non-client area. |
| 187 // Should only be big enough to accomodate a close button on the reasonably | 169 // Should only be big enough to accomodate a close button on the reasonably |
| 188 // recognisable titlebar. | 170 // recognisable titlebar. |
| 189 static const int kPanelMinWidth; | 171 static const int kPanelMinWidth; |
| 190 static const int kPanelMinHeight; | 172 static const int kPanelMinHeight; |
| 191 | 173 |
| 192 DISALLOW_COPY_AND_ASSIGN(PanelStrip); | 174 DISALLOW_COPY_AND_ASSIGN(PanelStrip); |
| 193 }; | 175 }; |
| 194 | 176 |
| 195 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ | 177 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
| OLD | NEW |