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