OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/docked_panel_strip.h" | 5 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 display_area_ = display_area; | 78 display_area_ = display_area; |
79 | 79 |
80 if (panels_.empty()) | 80 if (panels_.empty()) |
81 return; | 81 return; |
82 | 82 |
83 RefreshLayout(); | 83 RefreshLayout(); |
84 } | 84 } |
85 | 85 |
86 void DockedPanelStrip::AddPanel(Panel* panel) { | 86 void DockedPanelStrip::AddPanel(Panel* panel) { |
87 DCHECK_NE(this, panel->panel_strip()); | 87 DCHECK_NE(this, panel->panel_strip()); |
88 panel->set_panel_strip(this); | 88 panel->SetPanelStrip(this); |
89 | 89 |
90 // Always update limits, even on existing panels, in case the limits changed | 90 // Always update limits, even on existing panels, in case the limits changed |
91 // while panel was out of the strip. | 91 // while panel was out of the strip. |
92 int max_panel_width = GetMaxPanelWidth(); | 92 int max_panel_width = GetMaxPanelWidth(); |
93 int max_panel_height = GetMaxPanelHeight(); | 93 int max_panel_height = GetMaxPanelHeight(); |
94 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), | 94 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), |
95 gfx::Size(max_panel_width, max_panel_height)); | 95 gfx::Size(max_panel_width, max_panel_height)); |
96 | 96 |
97 gfx::Size restored_size = panel->restored_size(); | 97 gfx::Size restored_size = panel->restored_size(); |
98 int height = restored_size.height(); | 98 int height = restored_size.height(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return display_area_.right(); | 187 return display_area_.right(); |
188 } | 188 } |
189 | 189 |
190 int DockedPanelStrip::GetRightMostAvailablePosition() const { | 190 int DockedPanelStrip::GetRightMostAvailablePosition() const { |
191 return panels_.empty() ? StartingRightPosition() : | 191 return panels_.empty() ? StartingRightPosition() : |
192 (panels_.back()->GetBounds().x() - kPanelsHorizontalSpacing); | 192 (panels_.back()->GetBounds().x() - kPanelsHorizontalSpacing); |
193 } | 193 } |
194 | 194 |
195 void DockedPanelStrip::RemovePanel(Panel* panel) { | 195 void DockedPanelStrip::RemovePanel(Panel* panel) { |
196 DCHECK_EQ(this, panel->panel_strip()); | 196 DCHECK_EQ(this, panel->panel_strip()); |
197 panel->set_panel_strip(NULL); | 197 panel->SetPanelStrip(NULL); |
198 | 198 |
199 if (panel->expansion_state() != Panel::EXPANDED) | 199 if (panel->expansion_state() != Panel::EXPANDED) |
200 DecrementMinimizedPanels(); | 200 DecrementMinimizedPanels(); |
201 | 201 |
202 if (panel->has_temporary_layout()) { | 202 if (panel->has_temporary_layout()) { |
203 panels_in_temporary_layout_.erase(panel); | 203 panels_in_temporary_layout_.erase(panel); |
204 return; | 204 return; |
205 } | 205 } |
206 | 206 |
207 // Removing an element from the list will invalidate the iterator that refers | 207 // Removing an element from the list will invalidate the iterator that refers |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 DCHECK(panels_in_temporary_layout_.empty()); | 738 DCHECK(panels_in_temporary_layout_.empty()); |
739 | 739 |
740 // Make a copy of the iterator as closing panels can modify the vector. | 740 // Make a copy of the iterator as closing panels can modify the vector. |
741 Panels panels_copy = panels_; | 741 Panels panels_copy = panels_; |
742 | 742 |
743 // Start from the bottom to avoid reshuffling. | 743 // Start from the bottom to avoid reshuffling. |
744 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 744 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
745 iter != panels_copy.rend(); ++iter) | 745 iter != panels_copy.rend(); ++iter) |
746 (*iter)->Close(); | 746 (*iter)->Close(); |
747 } | 747 } |
OLD | NEW |