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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 drag_controller_->Drag(mouse_location); | 180 drag_controller_->Drag(mouse_location); |
181 } | 181 } |
182 | 182 |
183 void PanelManager::EndDragging(bool cancelled) { | 183 void PanelManager::EndDragging(bool cancelled) { |
184 drag_controller_->EndDragging(cancelled); | 184 drag_controller_->EndDragging(cancelled); |
185 } | 185 } |
186 | 186 |
187 void PanelManager::StartResizingByMouse(Panel* panel, | 187 void PanelManager::StartResizingByMouse(Panel* panel, |
188 const gfx::Point& mouse_location, | 188 const gfx::Point& mouse_location, |
189 panel::ResizingSides sides) { | 189 panel::ResizingSides sides) { |
190 if (panel->panel_strip() && panel->panel_strip()->CanResizePanel(panel) && | 190 if (panel->CanResizeByMouse() != panel::NOT_RESIZABLE && |
191 sides != panel::RESIZE_NONE) | 191 sides != panel::RESIZE_NONE) |
192 resize_controller_->StartResizing(panel, mouse_location, sides); | 192 resize_controller_->StartResizing(panel, mouse_location, sides); |
193 } | 193 } |
194 | 194 |
195 void PanelManager::ResizeByMouse(const gfx::Point& mouse_location) { | 195 void PanelManager::ResizeByMouse(const gfx::Point& mouse_location) { |
196 if (resize_controller_->IsResizing()) | 196 if (resize_controller_->IsResizing()) |
197 resize_controller_->Resize(mouse_location); | 197 resize_controller_->Resize(mouse_location); |
198 } | 198 } |
199 | 199 |
200 void PanelManager::EndResizingByMouse(bool cancelled) { | 200 void PanelManager::EndResizingByMouse(bool cancelled) { |
201 if (resize_controller_->IsResizing()) | 201 if (resize_controller_->IsResizing()) { |
202 resize_controller_->EndResizing(cancelled); | 202 Panel* resized_panel = resize_controller_->EndResizing(cancelled); |
| 203 if (!cancelled && resized_panel->panel_strip()) |
| 204 resized_panel->panel_strip()->RefreshLayout(); |
| 205 } |
203 } | 206 } |
204 | 207 |
205 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { | 208 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { |
206 // For panels outside of the docked strip changing state is a no-op. | 209 // For panels outside of the docked strip changing state is a no-op. |
207 // But since this method may be called for panels in other strips | 210 // But since this method may be called for panels in other strips |
208 // we need to check this condition. | 211 // we need to check this condition. |
209 if (panel->panel_strip() == docked_strip_.get()) | 212 if (panel->panel_strip() == docked_strip_.get()) |
210 docked_strip_->OnPanelExpansionStateChanged(panel); | 213 docked_strip_->OnPanelExpansionStateChanged(panel); |
211 | 214 |
212 } | 215 } |
(...skipping 19 matching lines...) Expand all Loading... |
232 // See the comment in OnWindowAutoResized() | 235 // See the comment in OnWindowAutoResized() |
233 if (panel_strip == overflow_strip_.get()) | 236 if (panel_strip == overflow_strip_.get()) |
234 docked_strip_->ResizePanelWindow(panel, new_size); | 237 docked_strip_->ResizePanelWindow(panel, new_size); |
235 else | 238 else |
236 panel_strip->ResizePanelWindow(panel, new_size); | 239 panel_strip->ResizePanelWindow(panel, new_size); |
237 panel->SetAutoResizable(false); | 240 panel->SetAutoResizable(false); |
238 } | 241 } |
239 | 242 |
240 void PanelManager::OnPanelResizedByMouse(Panel* panel, | 243 void PanelManager::OnPanelResizedByMouse(Panel* panel, |
241 const gfx::Rect& new_bounds) { | 244 const gfx::Rect& new_bounds) { |
| 245 panel->set_restored_size(new_bounds.size()); |
242 panel->panel_strip()->OnPanelResizedByMouse(panel, new_bounds); | 246 panel->panel_strip()->OnPanelResizedByMouse(panel, new_bounds); |
243 panel->SetAutoResizable(false); | 247 panel->SetAutoResizable(false); |
244 | |
245 } | 248 } |
246 | 249 |
247 void PanelManager::MovePanelToStrip( | 250 void PanelManager::MovePanelToStrip( |
248 Panel* panel, | 251 Panel* panel, |
249 PanelStrip::Type new_layout, | 252 PanelStrip::Type new_layout, |
250 PanelStrip::PositioningMask positioning_mask) { | 253 PanelStrip::PositioningMask positioning_mask) { |
251 DCHECK(panel); | 254 DCHECK(panel); |
252 PanelStrip* current_strip = panel->panel_strip(); | 255 PanelStrip* current_strip = panel->panel_strip(); |
253 DCHECK(current_strip); | 256 DCHECK(current_strip); |
254 DCHECK_NE(current_strip->type(), new_layout); | 257 DCHECK_NE(current_strip->type(), new_layout); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( | 382 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( |
380 kMoveNewPanelToOverflowDelayMs))); | 383 kMoveNewPanelToOverflowDelayMs))); |
381 } | 384 } |
382 | 385 |
383 content::NotificationService::current()->Notify( | 386 content::NotificationService::current()->Notify( |
384 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 387 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
385 content::Source<Panel>(panel), | 388 content::Source<Panel>(panel), |
386 content::NotificationService::NoDetails()); | 389 content::NotificationService::NoDetails()); |
387 } | 390 } |
388 | 391 |
OLD | NEW |