| 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 "ash/wm/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 delete iter->callout_widget; | 231 delete iter->callout_widget; |
| 232 } | 232 } |
| 233 panel_windows_.clear(); | 233 panel_windows_.clear(); |
| 234 if (launcher_) | 234 if (launcher_) |
| 235 launcher_->RemoveIconObserver(this); | 235 launcher_->RemoveIconObserver(this); |
| 236 launcher_ = NULL; | 236 launcher_ = NULL; |
| 237 } | 237 } |
| 238 | 238 |
| 239 void PanelLayoutManager::StartDragging(aura::Window* panel) { | 239 void PanelLayoutManager::StartDragging(aura::Window* panel) { |
| 240 DCHECK(!dragged_panel_); | 240 DCHECK(!dragged_panel_); |
| 241 DCHECK(panel->parent() == panel_container_); | |
| 242 dragged_panel_ = panel; | 241 dragged_panel_ = panel; |
| 243 Relayout(); | 242 Relayout(); |
| 244 } | 243 } |
| 245 | 244 |
| 246 void PanelLayoutManager::FinishDragging() { | 245 void PanelLayoutManager::FinishDragging() { |
| 247 // Note, dragged panel may be null if the panel was just attached to the | |
| 248 // panel layout. | |
| 249 dragged_panel_ = NULL; | 246 dragged_panel_ = NULL; |
| 250 Relayout(); | 247 Relayout(); |
| 251 } | 248 } |
| 252 | 249 |
| 253 void PanelLayoutManager::SetLauncher(ash::Launcher* launcher) { | 250 void PanelLayoutManager::SetLauncher(ash::Launcher* launcher) { |
| 254 launcher_ = launcher; | 251 launcher_ = launcher; |
| 255 launcher_->AddIconObserver(this); | 252 launcher_->AddIconObserver(this); |
| 256 } | 253 } |
| 257 | 254 |
| 258 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) { | 255 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 previous_panel = NULL; | 558 previous_panel = NULL; |
| 562 for (std::map<int, aura::Window*>::const_reverse_iterator it = | 559 for (std::map<int, aura::Window*>::const_reverse_iterator it = |
| 563 window_ordering.rbegin(); | 560 window_ordering.rbegin(); |
| 564 it != window_ordering.rend() && it->second != active_panel; ++it) { | 561 it != window_ordering.rend() && it->second != active_panel; ++it) { |
| 565 if (previous_panel) | 562 if (previous_panel) |
| 566 panel_container_->StackChildAbove(it->second, previous_panel); | 563 panel_container_->StackChildAbove(it->second, previous_panel); |
| 567 previous_panel = it->second; | 564 previous_panel = it->second; |
| 568 } | 565 } |
| 569 | 566 |
| 570 panel_container_->StackChildAtTop(active_panel); | 567 panel_container_->StackChildAtTop(active_panel); |
| 568 if (dragged_panel_ && dragged_panel_->parent() == panel_container_) |
| 569 panel_container_->StackChildAtTop(dragged_panel_); |
| 571 last_active_panel_ = active_panel; | 570 last_active_panel_ = active_panel; |
| 572 } | 571 } |
| 573 | 572 |
| 574 void PanelLayoutManager::UpdateCallouts() { | 573 void PanelLayoutManager::UpdateCallouts() { |
| 575 ShelfAlignment alignment = launcher_->alignment(); | 574 ShelfAlignment alignment = launcher_->alignment(); |
| 576 bool horizontal = alignment == SHELF_ALIGNMENT_TOP || | 575 bool horizontal = alignment == SHELF_ALIGNMENT_TOP || |
| 577 alignment == SHELF_ALIGNMENT_BOTTOM; | 576 alignment == SHELF_ALIGNMENT_BOTTOM; |
| 578 | 577 |
| 579 for (PanelList::iterator iter = panel_windows_.begin(); | 578 for (PanelList::iterator iter = panel_windows_.begin(); |
| 580 iter != panel_windows_.end(); ++iter) { | 579 iter != panel_windows_.end(); ++iter) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 618 |
| 620 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); | 619 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); |
| 621 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), | 620 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), |
| 622 panel); | 621 panel); |
| 623 callout_widget->Show(); | 622 callout_widget->Show(); |
| 624 } | 623 } |
| 625 } | 624 } |
| 626 | 625 |
| 627 } // namespace internal | 626 } // namespace internal |
| 628 } // namespace ash | 627 } // namespace ash |
| OLD | NEW |