| 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 #include <utility> |
| 9 | 10 |
| 10 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
| 11 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
| 12 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
| 13 #include "ash/shelf/shelf_types.h" | 14 #include "ash/shelf/shelf_types.h" |
| 14 #include "ash/shelf/shelf_util.h" | 15 #include "ash/shelf/shelf_util.h" |
| 15 #include "ash/shelf/shelf_widget.h" | 16 #include "ash/shelf/shelf_widget.h" |
| 16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 17 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 18 #include "ash/wm/overview/window_selector_controller.h" | 19 #include "ash/wm/overview/window_selector_controller.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 538 |
| 538 void PanelLayoutManager::WillChangeVisibilityState( | 539 void PanelLayoutManager::WillChangeVisibilityState( |
| 539 ShelfVisibilityState new_state) { | 540 ShelfVisibilityState new_state) { |
| 540 // On entering / leaving full screen mode the shelf visibility state is | 541 // On entering / leaving full screen mode the shelf visibility state is |
| 541 // changed to / from SHELF_HIDDEN. In this state, panel windows should hide | 542 // changed to / from SHELF_HIDDEN. In this state, panel windows should hide |
| 542 // to allow the full-screen application to use the full screen. | 543 // to allow the full-screen application to use the full screen. |
| 543 bool shelf_hidden = new_state == ash::SHELF_HIDDEN; | 544 bool shelf_hidden = new_state == ash::SHELF_HIDDEN; |
| 544 if (!shelf_hidden) { | 545 if (!shelf_hidden) { |
| 545 if (restore_windows_on_shelf_visible_) { | 546 if (restore_windows_on_shelf_visible_) { |
| 546 scoped_ptr<aura::WindowTracker> restore_windows( | 547 scoped_ptr<aura::WindowTracker> restore_windows( |
| 547 restore_windows_on_shelf_visible_.Pass()); | 548 std::move(restore_windows_on_shelf_visible_)); |
| 548 for (aura::Window::Windows::const_iterator iter = | 549 for (aura::Window::Windows::const_iterator iter = |
| 549 restore_windows->windows().begin(); | 550 restore_windows->windows().begin(); |
| 550 iter != restore_windows->windows().end(); ++iter) { | 551 iter != restore_windows->windows().end(); ++iter) { |
| 551 RestorePanel(*iter); | 552 RestorePanel(*iter); |
| 552 } | 553 } |
| 553 } | 554 } |
| 554 return; | 555 return; |
| 555 } | 556 } |
| 556 | 557 |
| 557 if (restore_windows_on_shelf_visible_) | 558 if (restore_windows_on_shelf_visible_) |
| 558 return; | 559 return; |
| 559 scoped_ptr<aura::WindowTracker> minimized_windows(new aura::WindowTracker); | 560 scoped_ptr<aura::WindowTracker> minimized_windows(new aura::WindowTracker); |
| 560 for (PanelList::iterator iter = panel_windows_.begin(); | 561 for (PanelList::iterator iter = panel_windows_.begin(); |
| 561 iter != panel_windows_.end();) { | 562 iter != panel_windows_.end();) { |
| 562 aura::Window* window = iter->window; | 563 aura::Window* window = iter->window; |
| 563 // Minimizing a panel window may remove it from the panel_windows_ list. | 564 // Minimizing a panel window may remove it from the panel_windows_ list. |
| 564 // Advance the iterator before minimizing it: http://crbug.com/393047. | 565 // Advance the iterator before minimizing it: http://crbug.com/393047. |
| 565 ++iter; | 566 ++iter; |
| 566 if (window != dragged_panel_ && window->IsVisible()) { | 567 if (window != dragged_panel_ && window->IsVisible()) { |
| 567 minimized_windows->Add(window); | 568 minimized_windows->Add(window); |
| 568 wm::GetWindowState(window)->Minimize(); | 569 wm::GetWindowState(window)->Minimize(); |
| 569 } | 570 } |
| 570 } | 571 } |
| 571 restore_windows_on_shelf_visible_ = minimized_windows.Pass(); | 572 restore_windows_on_shelf_visible_ = std::move(minimized_windows); |
| 572 } | 573 } |
| 573 | 574 |
| 574 //////////////////////////////////////////////////////////////////////////////// | 575 //////////////////////////////////////////////////////////////////////////////// |
| 575 // PanelLayoutManager private implementation: | 576 // PanelLayoutManager private implementation: |
| 576 | 577 |
| 577 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { | 578 void PanelLayoutManager::MinimizePanel(aura::Window* panel) { |
| 578 ::wm::SetWindowVisibilityAnimationType( | 579 ::wm::SetWindowVisibilityAnimationType( |
| 579 panel, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); | 580 panel, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); |
| 580 ui::Layer* layer = panel->layer(); | 581 ui::Layer* layer = panel->layer(); |
| 581 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); | 582 ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator()); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 // Keyboard hidden, restore original bounds if they exist. | 952 // Keyboard hidden, restore original bounds if they exist. |
| 952 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); | 953 SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen()); |
| 953 } | 954 } |
| 954 } | 955 } |
| 955 // This bounds change will have caused a change to the Shelf which does not | 956 // This bounds change will have caused a change to the Shelf which does not |
| 956 // propogate automatically to this class, so manually recalculate bounds. | 957 // propogate automatically to this class, so manually recalculate bounds. |
| 957 OnWindowResized(); | 958 OnWindowResized(); |
| 958 } | 959 } |
| 959 | 960 |
| 960 } // namespace ash | 961 } // namespace ash |
| OLD | NEW |