| 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 | 246 // Note, dragged panel may be null if the panel was just attached to the |
| 248 // panel layout. | 247 // panel layout. |
| 249 dragged_panel_ = NULL; | 248 dragged_panel_ = NULL; |
| 250 Relayout(); | 249 Relayout(); |
| 251 } | 250 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 272 } | 271 } |
| 273 | 272 |
| 274 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 273 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| 275 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 274 if (child->type() == aura::client::WINDOW_TYPE_POPUP) |
| 276 return; | 275 return; |
| 277 PanelInfo panel_info; | 276 PanelInfo panel_info; |
| 278 panel_info.window = child; | 277 panel_info.window = child; |
| 279 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 278 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
| 280 panel_windows_.push_back(panel_info); | 279 panel_windows_.push_back(panel_info); |
| 281 child->AddObserver(this); | 280 child->AddObserver(this); |
| 282 Relayout(); | 281 if (child != dragged_panel_) |
| 282 Relayout(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { | 285 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { |
| 286 } | 286 } |
| 287 | 287 |
| 288 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | 288 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { |
| 289 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 289 if (child->type() == aura::client::WINDOW_TYPE_POPUP) |
| 290 return; | 290 return; |
| 291 PanelList::iterator found = | 291 PanelList::iterator found = |
| 292 std::find(panel_windows_.begin(), panel_windows_.end(), child); | 292 std::find(panel_windows_.begin(), panel_windows_.end(), child); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 619 |
| 620 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); | 620 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); |
| 621 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), | 621 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), |
| 622 panel); | 622 panel); |
| 623 callout_widget->Show(); | 623 callout_widget->Show(); |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace internal | 627 } // namespace internal |
| 628 } // namespace ash | 628 } // namespace ash |
| OLD | NEW |