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 since this method may be called for panels in other strips |
| 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 // See the comment in OnWindowAutoResized() |
| 195 if (panel->panel_strip() == overflow_strip_.get()) |
| 196 docked_strip_->ResizePanelWindow(panel, new_size); |
| 197 else |
| 198 panel->panel_strip()->ResizePanelWindow(panel, new_size); |
183 panel->SetAutoResizable(false); | 199 panel->SetAutoResizable(false); |
184 } | 200 } |
185 | 201 |
186 void PanelManager::MovePanelToStrip( | 202 void PanelManager::MovePanelToStrip( |
187 Panel* panel, | 203 Panel* panel, |
188 PanelStrip::Type new_layout, | 204 PanelStrip::Type new_layout, |
189 PanelStrip::PositioningMask positioning_mask) { | 205 PanelStrip::PositioningMask positioning_mask) { |
190 DCHECK(panel); | 206 DCHECK(panel); |
191 PanelStrip* current_strip = panel->panel_strip(); | 207 PanelStrip* current_strip = panel->panel_strip(); |
192 DCHECK(current_strip); | 208 DCHECK(current_strip); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 return panels; | 342 return panels; |
327 } | 343 } |
328 | 344 |
329 int PanelManager::overflow_strip_width() const { | 345 int PanelManager::overflow_strip_width() const { |
330 return kOverflowStripThickness; | 346 return kOverflowStripThickness; |
331 } | 347 } |
332 | 348 |
333 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 349 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
334 panel_mouse_watcher_.reset(watcher); | 350 panel_mouse_watcher_.reset(watcher); |
335 } | 351 } |
OLD | NEW |