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/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 | 162 |
163 void PanelManager::Drag(const gfx::Point& mouse_location) { | 163 void PanelManager::Drag(const gfx::Point& mouse_location) { |
164 drag_controller_->Drag(mouse_location); | 164 drag_controller_->Drag(mouse_location); |
165 } | 165 } |
166 | 166 |
167 void PanelManager::EndDragging(bool cancelled) { | 167 void PanelManager::EndDragging(bool cancelled) { |
168 drag_controller_->EndDragging(cancelled); | 168 drag_controller_->EndDragging(cancelled); |
169 } | 169 } |
170 | 170 |
171 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { | 171 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { |
172 docked_strip_->OnPanelExpansionStateChanged(panel); | 172 // For panels outside of the docked strip changing state is a no-op. |
173 // But sicne this method may be called for panels in other strips | |
jennb
2012/03/14 20:11:40
typo: sicne
| |
174 // we need to check this condition. | |
175 if (panel->panel_strip() == docked_strip_.get()) | |
176 docked_strip_->OnPanelExpansionStateChanged(panel); | |
177 | |
173 } | 178 } |
174 | 179 |
175 void PanelManager::OnWindowAutoResized(Panel* panel, | 180 void PanelManager::OnWindowAutoResized(Panel* panel, |
176 const gfx::Size& preferred_window_size) { | 181 const gfx::Size& preferred_window_size) { |
177 DCHECK(auto_sizing_enabled_); | 182 DCHECK(auto_sizing_enabled_); |
178 docked_strip_->ResizePanelWindow(panel, preferred_window_size); | 183 // Even though overflow panels are always minimized, we need |
184 // to keep track of their size to put them back into the | |
185 // docked strip when they fit. So the docked panel strip manages | |
186 // the size of panels for the overflow strip as well. | |
187 if (panel->panel_strip() == overflow_strip_.get()) | |
188 docked_strip_->ResizePanelWindow(panel, preferred_window_size); | |
189 else | |
190 panel->panel_strip()->ResizePanelWindow(panel, preferred_window_size); | |
179 } | 191 } |
180 | 192 |
181 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { | 193 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { |
182 docked_strip_->ResizePanelWindow(panel, new_size); | 194 // We are not supposed to resize panels in the overflow. |
jennb
2012/03/14 20:11:40
Overflow panels - same logic as for OnWindowAutoRe
| |
195 DCHECK(panel->panel_strip() != overflow_strip_.get()); | |
196 panel->panel_strip()->ResizePanelWindow(panel, new_size); | |
183 panel->SetAutoResizable(false); | 197 panel->SetAutoResizable(false); |
184 } | 198 } |
185 | 199 |
186 void PanelManager::MovePanelToStrip( | 200 void PanelManager::MovePanelToStrip( |
187 Panel* panel, | 201 Panel* panel, |
188 PanelStrip::Type new_layout, | 202 PanelStrip::Type new_layout, |
189 PanelStrip::PositioningMask positioning_mask) { | 203 PanelStrip::PositioningMask positioning_mask) { |
190 DCHECK(panel); | 204 DCHECK(panel); |
191 PanelStrip* current_strip = panel->panel_strip(); | 205 PanelStrip* current_strip = panel->panel_strip(); |
192 DCHECK(current_strip); | 206 DCHECK(current_strip); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 return panels; | 340 return panels; |
327 } | 341 } |
328 | 342 |
329 int PanelManager::overflow_strip_width() const { | 343 int PanelManager::overflow_strip_width() const { |
330 return kOverflowStripThickness; | 344 return kOverflowStripThickness; |
331 } | 345 } |
332 | 346 |
333 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 347 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
334 panel_mouse_watcher_.reset(watcher); | 348 panel_mouse_watcher_.reset(watcher); |
335 } | 349 } |
OLD | NEW |