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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #include "ash/wm/window_cycle_controller.h" | 78 #include "ash/wm/window_cycle_controller.h" |
79 #include "ash/wm/window_positioner.h" | 79 #include "ash/wm/window_positioner.h" |
80 #include "ash/wm/window_properties.h" | 80 #include "ash/wm/window_properties.h" |
81 #include "ash/wm/window_util.h" | 81 #include "ash/wm/window_util.h" |
82 #include "ash/wm/workspace_controller.h" | 82 #include "ash/wm/workspace_controller.h" |
83 #include "base/bind.h" | 83 #include "base/bind.h" |
84 #include "base/bind_helpers.h" | 84 #include "base/bind_helpers.h" |
85 #include "base/command_line.h" | 85 #include "base/command_line.h" |
86 #include "base/debug/trace_event.h" | 86 #include "base/debug/trace_event.h" |
87 #include "ui/aura/client/aura_constants.h" | 87 #include "ui/aura/client/aura_constants.h" |
88 #include "ui/aura/client/user_action_client.h" | |
89 #include "ui/aura/env.h" | 88 #include "ui/aura/env.h" |
90 #include "ui/aura/layout_manager.h" | 89 #include "ui/aura/layout_manager.h" |
91 #include "ui/aura/window.h" | 90 #include "ui/aura/window.h" |
92 #include "ui/aura/window_event_dispatcher.h" | 91 #include "ui/aura/window_event_dispatcher.h" |
93 #include "ui/base/ui_base_switches.h" | 92 #include "ui/base/ui_base_switches.h" |
94 #include "ui/compositor/layer.h" | 93 #include "ui/compositor/layer.h" |
95 #include "ui/compositor/layer_animator.h" | 94 #include "ui/compositor/layer_animator.h" |
96 #include "ui/events/event_target_iterator.h" | 95 #include "ui/events/event_target_iterator.h" |
97 #include "ui/gfx/display.h" | 96 #include "ui/gfx/display.h" |
98 #include "ui/gfx/image/image_skia.h" | 97 #include "ui/gfx/image/image_skia.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 716 |
718 // These need a valid Shell instance to clean up properly, so explicitly | 717 // These need a valid Shell instance to clean up properly, so explicitly |
719 // delete them before invalidating the instance. | 718 // delete them before invalidating the instance. |
720 // Alphabetical. TODO(oshima): sort. | 719 // Alphabetical. TODO(oshima): sort. |
721 magnification_controller_.reset(); | 720 magnification_controller_.reset(); |
722 partial_magnification_controller_.reset(); | 721 partial_magnification_controller_.reset(); |
723 tooltip_controller_.reset(); | 722 tooltip_controller_.reset(); |
724 event_client_.reset(); | 723 event_client_.reset(); |
725 nested_dispatcher_controller_.reset(); | 724 nested_dispatcher_controller_.reset(); |
726 toplevel_window_event_handler_.reset(); | 725 toplevel_window_event_handler_.reset(); |
727 user_action_client_.reset(); | |
728 visibility_controller_.reset(); | 726 visibility_controller_.reset(); |
729 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be | 727 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
730 // destroyed before |shelf_model_| is destroyed. | 728 // destroyed before |shelf_model_| is destroyed. |
731 shelf_item_delegate_manager_.reset(); | 729 shelf_item_delegate_manager_.reset(); |
732 shelf_model_.reset(); | 730 shelf_model_.reset(); |
733 | 731 |
734 power_button_controller_.reset(); | 732 power_button_controller_.reset(); |
735 lock_state_controller_.reset(); | 733 lock_state_controller_.reset(); |
736 | 734 |
737 #if defined(OS_CHROMEOS) | 735 #if defined(OS_CHROMEOS) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 AddShellObserver(lock_state_controller_.get()); | 910 AddShellObserver(lock_state_controller_.get()); |
913 | 911 |
914 drag_drop_controller_.reset(new internal::DragDropController); | 912 drag_drop_controller_.reset(new internal::DragDropController); |
915 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); | 913 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); |
916 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 914 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
917 | 915 |
918 // Create Controllers that may need root window. | 916 // Create Controllers that may need root window. |
919 // TODO(oshima): Move as many controllers before creating | 917 // TODO(oshima): Move as many controllers before creating |
920 // RootWindowController as possible. | 918 // RootWindowController as possible. |
921 visibility_controller_.reset(new AshVisibilityController); | 919 visibility_controller_.reset(new AshVisibilityController); |
922 user_action_client_.reset(delegate_->CreateUserActionClient()); | |
923 | 920 |
924 magnification_controller_.reset( | 921 magnification_controller_.reset( |
925 MagnificationController::CreateInstance()); | 922 MagnificationController::CreateInstance()); |
926 mru_window_tracker_.reset(new MruWindowTracker(activation_client_)); | 923 mru_window_tracker_.reset(new MruWindowTracker(activation_client_)); |
927 | 924 |
928 partial_magnification_controller_.reset( | 925 partial_magnification_controller_.reset( |
929 new PartialMagnificationController()); | 926 new PartialMagnificationController()); |
930 | 927 |
931 autoclick_controller_.reset(AutoclickController::CreateInstance()); | 928 autoclick_controller_.reset(AutoclickController::CreateInstance()); |
932 | 929 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 | 1061 |
1065 aura::client::SetWindowMoveClient(root_window, | 1062 aura::client::SetWindowMoveClient(root_window, |
1066 toplevel_window_event_handler_.get()); | 1063 toplevel_window_event_handler_.get()); |
1067 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1064 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
1068 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1065 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
1069 | 1066 |
1070 if (nested_dispatcher_controller_) { | 1067 if (nested_dispatcher_controller_) { |
1071 aura::client::SetDispatcherClient(root_window, | 1068 aura::client::SetDispatcherClient(root_window, |
1072 nested_dispatcher_controller_.get()); | 1069 nested_dispatcher_controller_.get()); |
1073 } | 1070 } |
1074 if (user_action_client_) | |
1075 aura::client::SetUserActionClient(root_window, user_action_client_.get()); | |
1076 } | 1071 } |
1077 | 1072 |
1078 bool Shell::CanWindowReceiveEvents(aura::Window* window) { | 1073 bool Shell::CanWindowReceiveEvents(aura::Window* window) { |
1079 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1074 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1080 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1075 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1081 iter != controllers.end(); ++iter) { | 1076 iter != controllers.end(); ++iter) { |
1082 internal::SystemModalContainerLayoutManager* layout_manager = | 1077 internal::SystemModalContainerLayoutManager* layout_manager = |
1083 (*iter)->GetSystemModalLayoutManager(window); | 1078 (*iter)->GetSystemModalLayoutManager(window); |
1084 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) | 1079 if (layout_manager && layout_manager->CanWindowReceiveEvents(window)) |
1085 return true; | 1080 return true; |
(...skipping 27 matching lines...) Expand all Loading... |
1113 //////////////////////////////////////////////////////////////////////////////// | 1108 //////////////////////////////////////////////////////////////////////////////// |
1114 // Shell, aura::client::ActivationChangeObserver implementation: | 1109 // Shell, aura::client::ActivationChangeObserver implementation: |
1115 | 1110 |
1116 void Shell::OnWindowActivated(aura::Window* gained_active, | 1111 void Shell::OnWindowActivated(aura::Window* gained_active, |
1117 aura::Window* lost_active) { | 1112 aura::Window* lost_active) { |
1118 if (gained_active) | 1113 if (gained_active) |
1119 target_root_window_ = gained_active->GetRootWindow(); | 1114 target_root_window_ = gained_active->GetRootWindow(); |
1120 } | 1115 } |
1121 | 1116 |
1122 } // namespace ash | 1117 } // namespace ash |
OLD | NEW |