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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/aura/aura_layout_manager_adapter.h" | 10 #include "ash/aura/aura_layout_manager_adapter.h" |
11 #include "ash/aura/wm_shelf_aura.h" | 11 #include "ash/aura/wm_shelf_aura.h" |
12 #include "ash/aura/wm_window_aura.h" | 12 #include "ash/aura/wm_window_aura.h" |
13 #include "ash/common/ash_constants.h" | 13 #include "ash/common/ash_constants.h" |
14 #include "ash/common/ash_switches.h" | 14 #include "ash/common/ash_switches.h" |
15 #include "ash/common/focus_cycler.h" | 15 #include "ash/common/focus_cycler.h" |
16 #include "ash/common/login_status.h" | 16 #include "ash/common/login_status.h" |
17 #include "ash/common/root_window_controller_common.h" | 17 #include "ash/common/root_window_controller_common.h" |
18 #include "ash/common/session/session_state_delegate.h" | 18 #include "ash/common/session/session_state_delegate.h" |
19 #include "ash/common/shelf/shelf_types.h" | 19 #include "ash/common/shelf/shelf_types.h" |
| 20 #include "ash/common/shell_delegate.h" |
20 #include "ash/common/shell_window_ids.h" | 21 #include "ash/common/shell_window_ids.h" |
21 #include "ash/common/system/tray/system_tray_delegate.h" | 22 #include "ash/common/system/tray/system_tray_delegate.h" |
22 #include "ash/common/wm/always_on_top_controller.h" | 23 #include "ash/common/wm/always_on_top_controller.h" |
23 #include "ash/common/wm/container_finder.h" | 24 #include "ash/common/wm/container_finder.h" |
24 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 25 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
25 #include "ash/common/wm/fullscreen_window_finder.h" | 26 #include "ash/common/wm/fullscreen_window_finder.h" |
26 #include "ash/common/wm/panels/panel_layout_manager.h" | 27 #include "ash/common/wm/panels/panel_layout_manager.h" |
27 #include "ash/common/wm/root_window_layout_manager.h" | 28 #include "ash/common/wm/root_window_layout_manager.h" |
28 #include "ash/common/wm/switchable_windows.h" | 29 #include "ash/common/wm/switchable_windows.h" |
29 #include "ash/common/wm/window_state.h" | 30 #include "ash/common/wm/window_state.h" |
30 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 31 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
31 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" | 32 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" |
32 #include "ash/common/wm_shell.h" | 33 #include "ash/common/wm_shell.h" |
33 #include "ash/common/wm_window.h" | 34 #include "ash/common/wm_window.h" |
34 #include "ash/desktop_background/desktop_background_controller.h" | 35 #include "ash/desktop_background/desktop_background_controller.h" |
35 #include "ash/desktop_background/desktop_background_widget_controller.h" | 36 #include "ash/desktop_background/desktop_background_widget_controller.h" |
36 #include "ash/desktop_background/user_wallpaper_delegate.h" | 37 #include "ash/desktop_background/user_wallpaper_delegate.h" |
37 #include "ash/display/display_manager.h" | 38 #include "ash/display/display_manager.h" |
38 #include "ash/high_contrast/high_contrast_controller.h" | 39 #include "ash/high_contrast/high_contrast_controller.h" |
39 #include "ash/host/ash_window_tree_host.h" | 40 #include "ash/host/ash_window_tree_host.h" |
40 #include "ash/root_window_settings.h" | 41 #include "ash/root_window_settings.h" |
41 #include "ash/shelf/shelf_layout_manager.h" | 42 #include "ash/shelf/shelf_layout_manager.h" |
42 #include "ash/shelf/shelf_widget.h" | 43 #include "ash/shelf/shelf_widget.h" |
43 #include "ash/shell.h" | 44 #include "ash/shell.h" |
44 #include "ash/shell_delegate.h" | |
45 #include "ash/shell_factory.h" | 45 #include "ash/shell_factory.h" |
46 #include "ash/system/status_area_widget.h" | 46 #include "ash/system/status_area_widget.h" |
47 #include "ash/touch/touch_hud_debug.h" | 47 #include "ash/touch/touch_hud_debug.h" |
48 #include "ash/touch/touch_hud_projection.h" | 48 #include "ash/touch/touch_hud_projection.h" |
49 #include "ash/touch/touch_observer_hud.h" | 49 #include "ash/touch/touch_observer_hud.h" |
50 #include "ash/wm/lock_layout_manager.h" | 50 #include "ash/wm/lock_layout_manager.h" |
51 #include "ash/wm/panels/attached_panel_window_targeter.h" | 51 #include "ash/wm/panels/attached_panel_window_targeter.h" |
52 #include "ash/wm/panels/panel_window_event_handler.h" | 52 #include "ash/wm/panels/panel_window_event_handler.h" |
53 #include "ash/wm/stacking_controller.h" | 53 #include "ash/wm/stacking_controller.h" |
54 #include "ash/wm/status_area_layout_manager.h" | 54 #include "ash/wm/status_area_layout_manager.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ShelfLayoutManager* shelf_ = nullptr; | 307 ShelfLayoutManager* shelf_ = nullptr; |
308 | 308 |
309 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerDelegateImpl); | 309 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerDelegateImpl); |
310 }; | 310 }; |
311 | 311 |
312 } // namespace | 312 } // namespace |
313 | 313 |
314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { | 314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
315 RootWindowController* controller = new RootWindowController(host); | 315 RootWindowController* controller = new RootWindowController(host); |
316 controller->Init(RootWindowController::PRIMARY, | 316 controller->Init(RootWindowController::PRIMARY, |
317 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); | 317 WmShell::Get()->delegate()->IsFirstRunAfterBoot()); |
318 } | 318 } |
319 | 319 |
320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
321 RootWindowController* controller = new RootWindowController(host); | 321 RootWindowController* controller = new RootWindowController(host); |
322 controller->Init(RootWindowController::SECONDARY, false /* first run */); | 322 controller->Init(RootWindowController::SECONDARY, false /* first run */); |
323 } | 323 } |
324 | 324 |
325 // static | 325 // static |
326 RootWindowController* RootWindowController::ForWindow( | 326 RootWindowController* RootWindowController::ForWindow( |
327 const aura::Window* window) { | 327 const aura::Window* window) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 650 |
651 SystemTray* RootWindowController::GetSystemTray() { | 651 SystemTray* RootWindowController::GetSystemTray() { |
652 // We assume in throughout the code that this will not return NULL. If code | 652 // We assume in throughout the code that this will not return NULL. If code |
653 // triggers this for valid reasons, it should test status_area_widget first. | 653 // triggers this for valid reasons, it should test status_area_widget first. |
654 CHECK(shelf_widget_->status_area_widget()); | 654 CHECK(shelf_widget_->status_area_widget()); |
655 return shelf_widget_->status_area_widget()->system_tray(); | 655 return shelf_widget_->status_area_widget()->system_tray(); |
656 } | 656 } |
657 | 657 |
658 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, | 658 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, |
659 ui::MenuSourceType source_type) { | 659 ui::MenuSourceType source_type) { |
660 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 660 ShellDelegate* delegate = WmShell::Get()->delegate(); |
661 DCHECK(delegate); | 661 DCHECK(delegate); |
662 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr)); | 662 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr)); |
663 if (!menu_model_) | 663 if (!menu_model_) |
664 return; | 664 return; |
665 | 665 |
666 menu_model_adapter_.reset(new views::MenuModelAdapter( | 666 menu_model_adapter_.reset(new views::MenuModelAdapter( |
667 menu_model_.get(), | 667 menu_model_.get(), |
668 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this)))); | 668 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this)))); |
669 | 669 |
670 // Background controller may not be set yet if user clicked on status are | 670 // Background controller may not be set yet if user clicked on status are |
(...skipping 25 matching lines...) Expand all Loading... |
696 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 696 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
697 return; | 697 return; |
698 } | 698 } |
699 DCHECK(keyboard_controller); | 699 DCHECK(keyboard_controller); |
700 keyboard_controller->AddObserver(shelf_widget()->shelf_layout_manager()); | 700 keyboard_controller->AddObserver(shelf_widget()->shelf_layout_manager()); |
701 keyboard_controller->AddObserver(panel_layout_manager_); | 701 keyboard_controller->AddObserver(panel_layout_manager_); |
702 keyboard_controller->AddObserver(docked_layout_manager_); | 702 keyboard_controller->AddObserver(docked_layout_manager_); |
703 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); | 703 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); |
704 keyboard_controller->AddObserver( | 704 keyboard_controller->AddObserver( |
705 always_on_top_controller_->GetLayoutManager()); | 705 always_on_top_controller_->GetLayoutManager()); |
706 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); | 706 WmShell::Get()->delegate()->VirtualKeyboardActivated(true); |
707 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 707 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
708 DCHECK(parent); | 708 DCHECK(parent); |
709 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 709 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
710 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 710 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
711 parent->AddChild(keyboard_container); | 711 parent->AddChild(keyboard_container); |
712 } | 712 } |
713 | 713 |
714 void RootWindowController::DeactivateKeyboard( | 714 void RootWindowController::DeactivateKeyboard( |
715 keyboard::KeyboardController* keyboard_controller) { | 715 keyboard::KeyboardController* keyboard_controller) { |
716 if (!keyboard_controller || | 716 if (!keyboard_controller || |
717 !keyboard_controller->keyboard_container_initialized()) { | 717 !keyboard_controller->keyboard_container_initialized()) { |
718 return; | 718 return; |
719 } | 719 } |
720 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 720 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
721 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 721 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
722 aura::Window* parent = | 722 aura::Window* parent = |
723 GetContainer(kShellWindowId_ImeWindowParentContainer); | 723 GetContainer(kShellWindowId_ImeWindowParentContainer); |
724 DCHECK(parent); | 724 DCHECK(parent); |
725 parent->RemoveChild(keyboard_container); | 725 parent->RemoveChild(keyboard_container); |
726 // Virtual keyboard may be deactivated while still showing, notify all | 726 // Virtual keyboard may be deactivated while still showing, notify all |
727 // observers that keyboard bounds changed to 0 before remove them. | 727 // observers that keyboard bounds changed to 0 before remove them. |
728 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 728 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
729 keyboard_controller->RemoveObserver(shelf_widget()->shelf_layout_manager()); | 729 keyboard_controller->RemoveObserver(shelf_widget()->shelf_layout_manager()); |
730 keyboard_controller->RemoveObserver(panel_layout_manager_); | 730 keyboard_controller->RemoveObserver(panel_layout_manager_); |
731 keyboard_controller->RemoveObserver(docked_layout_manager_); | 731 keyboard_controller->RemoveObserver(docked_layout_manager_); |
732 keyboard_controller->RemoveObserver( | 732 keyboard_controller->RemoveObserver( |
733 workspace_controller_->layout_manager()); | 733 workspace_controller_->layout_manager()); |
734 keyboard_controller->RemoveObserver( | 734 keyboard_controller->RemoveObserver( |
735 always_on_top_controller_->GetLayoutManager()); | 735 always_on_top_controller_->GetLayoutManager()); |
736 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); | 736 WmShell::Get()->delegate()->VirtualKeyboardActivated(false); |
737 } | 737 } |
738 } | 738 } |
739 | 739 |
740 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 740 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
741 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 741 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
742 return parent ? parent->Contains(window) : false; | 742 return parent ? parent->Contains(window) : false; |
743 } | 743 } |
744 | 744 |
745 void RootWindowController::SetTouchAccessibilityAnchorPoint( | 745 void RootWindowController::SetTouchAccessibilityAnchorPoint( |
746 const gfx::Point& anchor_point) { | 746 const gfx::Point& anchor_point) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 aura::Window* primary_root_window = Shell::GetInstance() | 977 aura::Window* primary_root_window = Shell::GetInstance() |
978 ->window_tree_host_manager() | 978 ->window_tree_host_manager() |
979 ->GetPrimaryRootWindow(); | 979 ->GetPrimaryRootWindow(); |
980 return GetRootWindowSettings(primary_root_window)->controller; | 980 return GetRootWindowSettings(primary_root_window)->controller; |
981 } | 981 } |
982 | 982 |
983 return GetRootWindowSettings(root_window)->controller; | 983 return GetRootWindowSettings(root_window)->controller; |
984 } | 984 } |
985 | 985 |
986 } // namespace ash | 986 } // namespace ash |
OLD | NEW |