| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 return found->callout_widget; | 334 return found->callout_widget; |
| 335 } | 335 } |
| 336 | 336 |
| 337 //////////////////////////////////////////////////////////////////////////////// | 337 //////////////////////////////////////////////////////////////////////////////// |
| 338 // PanelLayoutManager, aura::LayoutManager implementation: | 338 // PanelLayoutManager, aura::LayoutManager implementation: |
| 339 void PanelLayoutManager::OnWindowResized() { | 339 void PanelLayoutManager::OnWindowResized() { |
| 340 Relayout(); | 340 Relayout(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 343 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| 344 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 344 if (child->type() == ui::wm::WINDOW_TYPE_POPUP) |
| 345 return; | 345 return; |
| 346 if (in_add_window_) | 346 if (in_add_window_) |
| 347 return; | 347 return; |
| 348 base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true); | 348 base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true); |
| 349 if (!wm::GetWindowState(child)->panel_attached()) { | 349 if (!wm::GetWindowState(child)->panel_attached()) { |
| 350 // This should only happen when a window is added to panel container as a | 350 // This should only happen when a window is added to panel container as a |
| 351 // result of bounds change from within the application during a drag. | 351 // result of bounds change from within the application during a drag. |
| 352 // If so we have already stopped the drag and should reparent the panel | 352 // If so we have already stopped the drag and should reparent the panel |
| 353 // back to appropriate container and ignore it. | 353 // back to appropriate container and ignore it. |
| 354 // TODO(varkha): Updating bounds during a drag can cause problems and a more | 354 // TODO(varkha): Updating bounds during a drag can cause problems and a more |
| (...skipping 17 matching lines...) Expand all Loading... |
| 372 panel_windows_.push_back(panel_info); | 372 panel_windows_.push_back(panel_info); |
| 373 child->AddObserver(this); | 373 child->AddObserver(this); |
| 374 wm::GetWindowState(child)->AddObserver(this); | 374 wm::GetWindowState(child)->AddObserver(this); |
| 375 Relayout(); | 375 Relayout(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { | 378 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { |
| 379 } | 379 } |
| 380 | 380 |
| 381 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | 381 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { |
| 382 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 382 if (child->type() == ui::wm::WINDOW_TYPE_POPUP) |
| 383 return; | 383 return; |
| 384 PanelList::iterator found = | 384 PanelList::iterator found = |
| 385 std::find(panel_windows_.begin(), panel_windows_.end(), child); | 385 std::find(panel_windows_.begin(), panel_windows_.end(), child); |
| 386 if (found != panel_windows_.end()) { | 386 if (found != panel_windows_.end()) { |
| 387 delete found->callout_widget; | 387 delete found->callout_widget; |
| 388 panel_windows_.erase(found); | 388 panel_windows_.erase(found); |
| 389 } | 389 } |
| 390 child->RemoveObserver(this); | 390 child->RemoveObserver(this); |
| 391 wm::GetWindowState(child)->RemoveObserver(this); | 391 wm::GetWindowState(child)->RemoveObserver(this); |
| 392 | 392 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 if (visible) | 485 if (visible) |
| 486 wm::GetWindowState(window)->Restore(); | 486 wm::GetWindowState(window)->Restore(); |
| 487 } | 487 } |
| 488 | 488 |
| 489 //////////////////////////////////////////////////////////////////////////////// | 489 //////////////////////////////////////////////////////////////////////////////// |
| 490 // PanelLayoutManager, aura::client::ActivationChangeObserver implementation: | 490 // PanelLayoutManager, aura::client::ActivationChangeObserver implementation: |
| 491 | 491 |
| 492 void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active, | 492 void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active, |
| 493 aura::Window* lost_active) { | 493 aura::Window* lost_active) { |
| 494 // Ignore if the panel that is not managed by this was activated. | 494 // Ignore if the panel that is not managed by this was activated. |
| 495 if (gained_active && | 495 if (gained_active && gained_active->type() == ui::wm::WINDOW_TYPE_PANEL && |
| 496 gained_active->type() == aura::client::WINDOW_TYPE_PANEL && | |
| 497 gained_active->parent() == panel_container_) { | 496 gained_active->parent() == panel_container_) { |
| 498 UpdateStacking(gained_active); | 497 UpdateStacking(gained_active); |
| 499 UpdateCallouts(); | 498 UpdateCallouts(); |
| 500 } | 499 } |
| 501 } | 500 } |
| 502 | 501 |
| 503 //////////////////////////////////////////////////////////////////////////////// | 502 //////////////////////////////////////////////////////////////////////////////// |
| 504 // PanelLayoutManager, DisplayController::Observer implementation: | 503 // PanelLayoutManager, DisplayController::Observer implementation: |
| 505 | 504 |
| 506 void PanelLayoutManager::OnDisplayConfigurationChanged() { | 505 void PanelLayoutManager::OnDisplayConfigurationChanged() { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 885 |
| 887 void PanelLayoutManager::OnKeyboardBoundsChanging( | 886 void PanelLayoutManager::OnKeyboardBoundsChanging( |
| 888 const gfx::Rect& keyboard_bounds) { | 887 const gfx::Rect& keyboard_bounds) { |
| 889 // This bounds change will have caused a change to the Shelf which does not | 888 // This bounds change will have caused a change to the Shelf which does not |
| 890 // propogate automatically to this class, so manually recalculate bounds. | 889 // propogate automatically to this class, so manually recalculate bounds. |
| 891 OnWindowResized(); | 890 OnWindowResized(); |
| 892 } | 891 } |
| 893 | 892 |
| 894 } // namespace internal | 893 } // namespace internal |
| 895 } // namespace ash | 894 } // namespace ash |
| OLD | NEW |