| 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" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 collection->UpdatePanelOnCollectionChange(panel); | 279 collection->UpdatePanelOnCollectionChange(panel); |
| 280 | 280 |
| 281 return panel; | 281 return panel; |
| 282 } | 282 } |
| 283 | 283 |
| 284 PanelCollection* PanelManager::GetCollectionForNewPanel( | 284 PanelCollection* PanelManager::GetCollectionForNewPanel( |
| 285 Panel* new_panel, | 285 Panel* new_panel, |
| 286 const gfx::Rect& bounds, | 286 const gfx::Rect& bounds, |
| 287 CreateMode mode, | 287 CreateMode mode, |
| 288 PanelCollection::PositioningMask* positioning_mask) { | 288 PanelCollection::PositioningMask* positioning_mask) { |
| 289 if (mode == CREATE_AS_DOCKED) { | 289 if (mode == CREATE_AS_DOCKED) |
| 290 // Delay layout refreshes in case multiple panels are created within | |
| 291 // a short time of one another or the focus changes shortly after panel | |
| 292 // is created to avoid excessive screen redraws. | |
| 293 *positioning_mask = PanelCollection::DELAY_LAYOUT_REFRESH; | |
| 294 return docked_collection_.get(); | 290 return docked_collection_.get(); |
| 295 } | |
| 296 | 291 |
| 297 DCHECK_EQ(CREATE_AS_DETACHED, mode); | 292 DCHECK_EQ(CREATE_AS_DETACHED, mode); |
| 298 *positioning_mask = PanelCollection::DEFAULT_POSITION; | 293 *positioning_mask = PanelCollection::DEFAULT_POSITION; |
| 299 | 294 |
| 300 // If the stacking support is not enabled, new panel will still be created as | 295 // If the stacking support is not enabled, new panel will still be created as |
| 301 // detached. | 296 // detached. |
| 302 if (!IsPanelStackingEnabled()) | 297 if (!IsPanelStackingEnabled()) |
| 303 return detached_collection_.get(); | 298 return detached_collection_.get(); |
| 304 | 299 |
| 305 // If there're stacks, try to find a stack that can fit new panel. | 300 // If there're stacks, try to find a stack that can fit new panel. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 545 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
| 551 panel_mouse_watcher_.reset(watcher); | 546 panel_mouse_watcher_.reset(watcher); |
| 552 } | 547 } |
| 553 | 548 |
| 554 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 549 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
| 555 content::NotificationService::current()->Notify( | 550 content::NotificationService::current()->Notify( |
| 556 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 551 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 557 content::Source<Panel>(panel), | 552 content::Source<Panel>(panel), |
| 558 content::NotificationService::NoDetails()); | 553 content::NotificationService::NoDetails()); |
| 559 } | 554 } |
| OLD | NEW |