| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "ash/wm/coordinate_conversion.h" | 49 #include "ash/wm/coordinate_conversion.h" |
| 50 #include "ash/wm/custom_frame_view_ash.h" | 50 #include "ash/wm/custom_frame_view_ash.h" |
| 51 #include "ash/wm/event_client_impl.h" | 51 #include "ash/wm/event_client_impl.h" |
| 52 #include "ash/wm/event_rewriter_event_filter.h" | 52 #include "ash/wm/event_rewriter_event_filter.h" |
| 53 #include "ash/wm/lock_state_controller.h" | 53 #include "ash/wm/lock_state_controller.h" |
| 54 #include "ash/wm/lock_state_controller_impl2.h" | 54 #include "ash/wm/lock_state_controller_impl2.h" |
| 55 #include "ash/wm/mru_window_tracker.h" | 55 #include "ash/wm/mru_window_tracker.h" |
| 56 #include "ash/wm/overlay_event_filter.h" | 56 #include "ash/wm/overlay_event_filter.h" |
| 57 #include "ash/wm/overview/window_selector_controller.h" | 57 #include "ash/wm/overview/window_selector_controller.h" |
| 58 #include "ash/wm/power_button_controller.h" | 58 #include "ash/wm/power_button_controller.h" |
| 59 #include "ash/wm/property_util.h" | |
| 60 #include "ash/wm/resize_shadow_controller.h" | 59 #include "ash/wm/resize_shadow_controller.h" |
| 61 #include "ash/wm/root_window_layout_manager.h" | 60 #include "ash/wm/root_window_layout_manager.h" |
| 62 #include "ash/wm/screen_dimmer.h" | 61 #include "ash/wm/screen_dimmer.h" |
| 63 #include "ash/wm/session_state_controller_impl.h" | 62 #include "ash/wm/session_state_controller_impl.h" |
| 64 #include "ash/wm/system_gesture_event_filter.h" | 63 #include "ash/wm/system_gesture_event_filter.h" |
| 65 #include "ash/wm/system_modal_container_event_filter.h" | 64 #include "ash/wm/system_modal_container_event_filter.h" |
| 66 #include "ash/wm/system_modal_container_layout_manager.h" | 65 #include "ash/wm/system_modal_container_layout_manager.h" |
| 67 #include "ash/wm/user_activity_detector.h" | 66 #include "ash/wm/user_activity_detector.h" |
| 68 #include "ash/wm/video_detector.h" | 67 #include "ash/wm/video_detector.h" |
| 69 #include "ash/wm/window_animations.h" | 68 #include "ash/wm/window_animations.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 } | 360 } |
| 362 | 361 |
| 363 // static | 362 // static |
| 364 void Shell::DeleteInstance() { | 363 void Shell::DeleteInstance() { |
| 365 delete instance_; | 364 delete instance_; |
| 366 instance_ = NULL; | 365 instance_ = NULL; |
| 367 } | 366 } |
| 368 | 367 |
| 369 // static | 368 // static |
| 370 internal::RootWindowController* Shell::GetPrimaryRootWindowController() { | 369 internal::RootWindowController* Shell::GetPrimaryRootWindowController() { |
| 371 return GetRootWindowController(GetPrimaryRootWindow()); | 370 return internal::GetRootWindowController(GetPrimaryRootWindow()); |
| 372 } | 371 } |
| 373 | 372 |
| 374 // static | 373 // static |
| 375 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { | 374 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { |
| 376 return Shell::GetInstance()->display_controller()-> | 375 return Shell::GetInstance()->display_controller()-> |
| 377 GetAllRootWindowControllers(); | 376 GetAllRootWindowControllers(); |
| 378 } | 377 } |
| 379 | 378 |
| 380 // static | 379 // static |
| 381 aura::RootWindow* Shell::GetPrimaryRootWindow() { | 380 aura::RootWindow* Shell::GetPrimaryRootWindow() { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // No context menus when screen is locked. | 638 // No context menus when screen is locked. |
| 640 if (session_state_delegate_->IsScreenLocked()) | 639 if (session_state_delegate_->IsScreenLocked()) |
| 641 return; | 640 return; |
| 642 | 641 |
| 643 aura::RootWindow* root = | 642 aura::RootWindow* root = |
| 644 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); | 643 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); |
| 645 // TODO(oshima): The root and root window controller shouldn't be | 644 // TODO(oshima): The root and root window controller shouldn't be |
| 646 // NULL even for the out-of-bounds |location_in_screen| (It should | 645 // NULL even for the out-of-bounds |location_in_screen| (It should |
| 647 // return the primary root). Investigate why/how this is | 646 // return the primary root). Investigate why/how this is |
| 648 // happening. crbug.com/165214. | 647 // happening. crbug.com/165214. |
| 649 internal::RootWindowController* rwc = GetRootWindowController(root); | 648 internal::RootWindowController* rwc = internal::GetRootWindowController(root); |
| 650 CHECK(rwc) << "root=" << root | 649 CHECK(rwc) << "root=" << root |
| 651 << ", location:" << location_in_screen.ToString(); | 650 << ", location:" << location_in_screen.ToString(); |
| 652 if (rwc) | 651 if (rwc) |
| 653 rwc->ShowContextMenu(location_in_screen, source_type); | 652 rwc->ShowContextMenu(location_in_screen, source_type); |
| 654 } | 653 } |
| 655 | 654 |
| 656 void Shell::ToggleAppList(aura::Window* window) { | 655 void Shell::ToggleAppList(aura::Window* window) { |
| 657 // If the context window is not given, show it on the active root window. | 656 // If the context window is not given, show it on the active root window. |
| 658 if (!window) | 657 if (!window) |
| 659 window = GetActiveRootWindow(); | 658 window = GetActiveRootWindow(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 void Shell::SetShelfAlignment(ShelfAlignment alignment, | 788 void Shell::SetShelfAlignment(ShelfAlignment alignment, |
| 790 aura::RootWindow* root_window) { | 789 aura::RootWindow* root_window) { |
| 791 if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> | 790 if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 792 SetAlignment(alignment)) { | 791 SetAlignment(alignment)) { |
| 793 FOR_EACH_OBSERVER( | 792 FOR_EACH_OBSERVER( |
| 794 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); | 793 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); |
| 795 } | 794 } |
| 796 } | 795 } |
| 797 | 796 |
| 798 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { | 797 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { |
| 799 return GetRootWindowController(root_window)-> | 798 return internal::GetRootWindowController(root_window)-> |
| 800 GetShelfLayoutManager()->GetAlignment(); | 799 GetShelfLayoutManager()->GetAlignment(); |
| 801 } | 800 } |
| 802 | 801 |
| 803 void Shell::SetDimming(bool should_dim) { | 802 void Shell::SetDimming(bool should_dim) { |
| 804 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 803 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 805 for (RootWindowControllerList::iterator iter = controllers.begin(); | 804 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 806 iter != controllers.end(); ++iter) | 805 iter != controllers.end(); ++iter) |
| 807 (*iter)->screen_dimmer()->SetDimming(should_dim); | 806 (*iter)->screen_dimmer()->SetDimming(should_dim); |
| 808 } | 807 } |
| 809 | 808 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 //////////////////////////////////////////////////////////////////////////////// | 964 //////////////////////////////////////////////////////////////////////////////// |
| 966 // Shell, aura::client::ActivationChangeObserver implementation: | 965 // Shell, aura::client::ActivationChangeObserver implementation: |
| 967 | 966 |
| 968 void Shell::OnWindowActivated(aura::Window* gained_active, | 967 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 969 aura::Window* lost_active) { | 968 aura::Window* lost_active) { |
| 970 if (gained_active) | 969 if (gained_active) |
| 971 target_root_window_ = gained_active->GetRootWindow(); | 970 target_root_window_ = gained_active->GetRootWindow(); |
| 972 } | 971 } |
| 973 | 972 |
| 974 } // namespace ash | 973 } // namespace ash |
| OLD | NEW |