Chromium Code Reviews| 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/workspace/workspace_manager.h" | 5 #include "ash/wm/workspace/workspace_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shelf/shelf_widget.h" | |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
| 14 #include "ash/wm/base_layout_manager.h" | 15 #include "ash/wm/base_layout_manager.h" |
| 15 #include "ash/wm/frame_painter.h" | 16 #include "ash/wm/frame_painter.h" |
| 16 #include "ash/wm/property_util.h" | 17 #include "ash/wm/property_util.h" |
| 17 #include "ash/wm/window_animations.h" | 18 #include "ash/wm/window_animations.h" |
| 18 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
| 20 #include "ash/wm/workspace/auto_window_management.h" | 21 #include "ash/wm/workspace/auto_window_management.h" |
| 21 #include "ash/wm/workspace/desktop_background_fade_controller.h" | 22 #include "ash/wm/workspace/desktop_background_fade_controller.h" |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 SWITCH_MAXIMIZED_OR_RESTORED); | 684 SWITCH_MAXIMIZED_OR_RESTORED); |
| 684 if (FindWorkspace(workspace) == workspaces_.end()) | 685 if (FindWorkspace(workspace) == workspaces_.end()) |
| 685 workspace = NULL; | 686 workspace = NULL; |
| 686 } | 687 } |
| 687 } else if ((full_count == 1 && workspace == desktop_workspace()) || | 688 } else if ((full_count == 1 && workspace == desktop_workspace()) || |
| 688 full_count > 1) { | 689 full_count > 1) { |
| 689 new_workspace = CreateWorkspace(true); | 690 new_workspace = CreateWorkspace(true); |
| 690 pending_workspaces_.insert(new_workspace); | 691 pending_workspaces_.insert(new_workspace); |
| 691 ReparentWindow(child, new_workspace->window(), NULL); | 692 ReparentWindow(child, new_workspace->window(), NULL); |
| 692 } | 693 } |
| 694 if (full_count > 0) { | |
|
Jun Mukai
2013/07/13 00:51:16
It is not very good to hook just here.
Instead, be
| |
| 695 // Hide notifications if there are fullscreen windows. | |
| 696 Shell::RootWindowControllerList controllers = | |
| 697 Shell::GetAllRootWindowControllers(); | |
| 698 Shell::RootWindowControllerList::iterator iter = controllers.begin(); | |
| 699 for ( ; iter != controllers.end(); iter++) { | |
| 700 (*iter)->shelf()->status_area_widget()->SetHideWebNotifications( | |
| 701 true); | |
| 702 } | |
| 703 } | |
| 704 | |
| 705 | |
| 693 if (is_active && new_workspace) { | 706 if (is_active && new_workspace) { |
| 694 // |old_layer| may be NULL if as part of processing | 707 // |old_layer| may be NULL if as part of processing |
| 695 // WorkspaceLayoutManager::OnWindowPropertyChanged() the window is made | 708 // WorkspaceLayoutManager::OnWindowPropertyChanged() the window is made |
| 696 // active. | 709 // active. |
| 697 if (old_layer) { | 710 if (old_layer) { |
| 698 SetActiveWorkspace(new_workspace, | 711 SetActiveWorkspace(new_workspace, |
| 699 full_count >= 2 ? | 712 full_count >= 2 ? |
| 700 SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE : | 713 SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE : |
| 701 SWITCH_MAXIMIZED_OR_RESTORED); | 714 SWITCH_MAXIMIZED_OR_RESTORED); |
| 702 CrossFadeWindowBetweenWorkspaces(new_workspace->window(), child, | 715 CrossFadeWindowBetweenWorkspaces(new_workspace->window(), child, |
| 703 old_layer); | 716 old_layer); |
| 704 if (workspace == desktop_workspace() || | 717 if (workspace == desktop_workspace() || |
| 705 new_workspace == desktop_workspace()) { | 718 new_workspace == desktop_workspace()) { |
| 706 FadeDesktop(child, duration); | 719 FadeDesktop(child, duration); |
| 707 } | 720 } |
| 708 } else { | 721 } else { |
| 709 SetActiveWorkspace(new_workspace, SWITCH_OTHER); | 722 SetActiveWorkspace(new_workspace, SWITCH_OTHER); |
| 710 } | 723 } |
| 711 } else { | 724 } else { |
| 712 if (last_show_state == ui::SHOW_STATE_MINIMIZED) | 725 if (last_show_state == ui::SHOW_STATE_MINIMIZED) |
| 713 SetUnminimizingWorkspace(new_workspace ? new_workspace : workspace); | 726 SetUnminimizingWorkspace(new_workspace ? new_workspace : workspace); |
| 714 DCHECK(!old_layer); | 727 DCHECK(!old_layer); |
| 715 } | 728 } |
| 716 } | 729 } |
| 717 UpdateShelfVisibility(); | 730 UpdateShelfVisibility(); |
| 731 | |
| 718 } | 732 } |
| 719 | 733 |
| 720 void WorkspaceManager::OnTrackedByWorkspaceChanged(Workspace* workspace, | 734 void WorkspaceManager::OnTrackedByWorkspaceChanged(Workspace* workspace, |
| 721 aura::Window* window) { | 735 aura::Window* window) { |
| 722 Workspace* new_workspace = NULL; | 736 Workspace* new_workspace = NULL; |
| 723 if (wm::IsWindowFullscreen(window)) { | 737 if (wm::IsWindowFullscreen(window)) { |
| 724 if (workspace->is_fullscreen() && | 738 if (workspace->is_fullscreen() && |
| 725 workspace->GetNumFullscreenWindows() == 1) { | 739 workspace->GetNumFullscreenWindows() == 1) { |
| 726 // If |window| is the only window in a fullscreen workspace then leave | 740 // If |window| is the only window in a fullscreen workspace then leave |
| 727 // it there. Additionally animate it back to the origin. | 741 // it there. Additionally animate it back to the origin. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 747 if (is_active) | 761 if (is_active) |
| 748 new_workspace->window()->Show(); | 762 new_workspace->window()->Show(); |
| 749 ReparentWindow(window, new_workspace->window(), NULL); | 763 ReparentWindow(window, new_workspace->window(), NULL); |
| 750 if (is_active) { | 764 if (is_active) { |
| 751 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED); | 765 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED); |
| 752 } | 766 } |
| 753 } | 767 } |
| 754 | 768 |
| 755 } // namespace internal | 769 } // namespace internal |
| 756 } // namespace ash | 770 } // namespace ash |
| OLD | NEW |