| 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/bind.h" | 7 #include "base/bind.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" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/panels/detached_panel_strip.h" | 15 #include "chrome/browser/ui/panels/detached_panel_strip.h" |
| 15 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 16 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
| 16 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 17 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
| 17 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 18 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 18 #include "chrome/browser/ui/panels/panel_resize_controller.h" | 19 #include "chrome/browser/ui/panels/panel_resize_controller.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/chrome_version_info.h" | 22 #include "chrome/common/chrome_version_info.h" |
| 22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 210 |
| 210 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { | 211 void PanelManager::OnPanelExpansionStateChanged(Panel* panel) { |
| 211 // For panels outside of the docked strip changing state is a no-op. | 212 // For panels outside of the docked strip changing state is a no-op. |
| 212 // But since this method may be called for panels in other strips | 213 // But since this method may be called for panels in other strips |
| 213 // we need to check this condition. | 214 // we need to check this condition. |
| 214 if (panel->panel_strip() == docked_strip_.get()) | 215 if (panel->panel_strip() == docked_strip_.get()) |
| 215 docked_strip_->OnPanelExpansionStateChanged(panel); | 216 docked_strip_->OnPanelExpansionStateChanged(panel); |
| 216 | 217 |
| 217 } | 218 } |
| 218 | 219 |
| 219 void PanelManager::OnWindowAutoResized(Panel* panel, | |
| 220 const gfx::Size& preferred_window_size) { | |
| 221 DCHECK(auto_sizing_enabled_); | |
| 222 panel->panel_strip()->ResizePanelWindow(panel, preferred_window_size); | |
| 223 } | |
| 224 | |
| 225 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { | 220 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { |
| 226 PanelStrip* panel_strip = panel->panel_strip(); | 221 PanelStrip* panel_strip = panel->panel_strip(); |
| 227 if (!panel_strip) | 222 if (!panel_strip) |
| 228 return; | 223 return; |
| 229 panel_strip->ResizePanelWindow(panel, new_size); | 224 panel_strip->ResizePanelWindow(panel, new_size); |
| 230 panel->SetAutoResizable(false); | 225 panel->SetAutoResizable(false); |
| 231 } | 226 } |
| 232 | 227 |
| 233 void PanelManager::OnPanelResizedByMouse(Panel* panel, | 228 void PanelManager::OnPanelResizedByMouse(Panel* panel, |
| 234 const gfx::Rect& new_bounds) { | 229 const gfx::Rect& new_bounds) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 305 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
| 311 panel_mouse_watcher_.reset(watcher); | 306 panel_mouse_watcher_.reset(watcher); |
| 312 } | 307 } |
| 313 | 308 |
| 314 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 309 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
| 315 content::NotificationService::current()->Notify( | 310 content::NotificationService::current()->Notify( |
| 316 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 311 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 317 content::Source<Panel>(panel), | 312 content::Source<Panel>(panel), |
| 318 content::NotificationService::NoDetails()); | 313 content::NotificationService::NoDetails()); |
| 319 } | 314 } |
| OLD | NEW |