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 12 matching lines...) Expand all Loading... |
23 #include "ash/display/event_transformation_handler.h" | 23 #include "ash/display/event_transformation_handler.h" |
24 #include "ash/display/mouse_cursor_event_filter.h" | 24 #include "ash/display/mouse_cursor_event_filter.h" |
25 #include "ash/display/screen_position_controller.h" | 25 #include "ash/display/screen_position_controller.h" |
26 #include "ash/display/virtual_keyboard_window_controller.h" | 26 #include "ash/display/virtual_keyboard_window_controller.h" |
27 #include "ash/drag_drop/drag_drop_controller.h" | 27 #include "ash/drag_drop/drag_drop_controller.h" |
28 #include "ash/first_run/first_run_helper_impl.h" | 28 #include "ash/first_run/first_run_helper_impl.h" |
29 #include "ash/focus_cycler.h" | 29 #include "ash/focus_cycler.h" |
30 #include "ash/frame/custom_frame_view_ash.h" | 30 #include "ash/frame/custom_frame_view_ash.h" |
31 #include "ash/gpu_support.h" | 31 #include "ash/gpu_support.h" |
32 #include "ash/high_contrast/high_contrast_controller.h" | 32 #include "ash/high_contrast/high_contrast_controller.h" |
| 33 #include "ash/host/ash_window_tree_host_init_params.h" |
33 #include "ash/keyboard_uma_event_filter.h" | 34 #include "ash/keyboard_uma_event_filter.h" |
34 #include "ash/magnifier/magnification_controller.h" | 35 #include "ash/magnifier/magnification_controller.h" |
35 #include "ash/magnifier/partial_magnification_controller.h" | 36 #include "ash/magnifier/partial_magnification_controller.h" |
36 #include "ash/media_delegate.h" | 37 #include "ash/media_delegate.h" |
37 #include "ash/new_window_delegate.h" | 38 #include "ash/new_window_delegate.h" |
38 #include "ash/root_window_controller.h" | 39 #include "ash/root_window_controller.h" |
39 #include "ash/session/session_state_delegate.h" | 40 #include "ash/session/session_state_delegate.h" |
40 #include "ash/shelf/app_list_shelf_item_delegate.h" | 41 #include "ash/shelf/app_list_shelf_item_delegate.h" |
41 #include "ash/shelf/shelf_delegate.h" | 42 #include "ash/shelf/shelf_delegate.h" |
42 #include "ash/shelf/shelf_item_delegate.h" | 43 #include "ash/shelf/shelf_item_delegate.h" |
43 #include "ash/shelf/shelf_item_delegate_manager.h" | 44 #include "ash/shelf/shelf_item_delegate_manager.h" |
44 #include "ash/shelf/shelf_layout_manager.h" | 45 #include "ash/shelf/shelf_layout_manager.h" |
45 #include "ash/shelf/shelf_model.h" | 46 #include "ash/shelf/shelf_model.h" |
46 #include "ash/shelf/shelf_widget.h" | 47 #include "ash/shelf/shelf_widget.h" |
47 #include "ash/shelf/shelf_window_watcher.h" | 48 #include "ash/shelf/shelf_window_watcher.h" |
48 #include "ash/shell_delegate.h" | 49 #include "ash/shell_delegate.h" |
49 #include "ash/shell_factory.h" | 50 #include "ash/shell_factory.h" |
| 51 #include "ash/shell_init_params.h" |
50 #include "ash/shell_window_ids.h" | 52 #include "ash/shell_window_ids.h" |
51 #include "ash/system/locale/locale_notification_controller.h" | 53 #include "ash/system/locale/locale_notification_controller.h" |
52 #include "ash/system/status_area_widget.h" | 54 #include "ash/system/status_area_widget.h" |
53 #include "ash/system/tray/system_tray_delegate.h" | 55 #include "ash/system/tray/system_tray_delegate.h" |
54 #include "ash/system/tray/system_tray_notifier.h" | 56 #include "ash/system/tray/system_tray_notifier.h" |
55 #include "ash/wm/app_list_controller.h" | 57 #include "ash/wm/app_list_controller.h" |
56 #include "ash/wm/ash_focus_rules.h" | 58 #include "ash/wm/ash_focus_rules.h" |
57 #include "ash/wm/ash_native_cursor_manager.h" | 59 #include "ash/wm/ash_native_cursor_manager.h" |
58 #include "ash/wm/coordinate_conversion.h" | 60 #include "ash/wm/coordinate_conversion.h" |
59 #include "ash/wm/event_client_impl.h" | 61 #include "ash/wm/event_client_impl.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Overridden from ::wm::VisibilityController: | 158 // Overridden from ::wm::VisibilityController: |
157 virtual bool CallAnimateOnChildWindowVisibilityChanged( | 159 virtual bool CallAnimateOnChildWindowVisibilityChanged( |
158 aura::Window* window, | 160 aura::Window* window, |
159 bool visible) OVERRIDE { | 161 bool visible) OVERRIDE { |
160 return AnimateOnChildWindowVisibilityChanged(window, visible); | 162 return AnimateOnChildWindowVisibilityChanged(window, visible); |
161 } | 163 } |
162 | 164 |
163 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); | 165 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); |
164 }; | 166 }; |
165 | 167 |
| 168 AshWindowTreeHostInitParams ShellInitParamsToAshWindowTreeHostInitParams( |
| 169 const ShellInitParams& shell_init_params) { |
| 170 AshWindowTreeHostInitParams ash_init_params; |
| 171 #if defined(OS_WIN) |
| 172 ash_init_params.remote_hwnd = shell_init_params.remote_hwnd; |
| 173 #endif |
| 174 return ash_init_params; |
| 175 } |
| 176 |
166 } // namespace | 177 } // namespace |
167 | 178 |
168 // static | 179 // static |
169 Shell* Shell::instance_ = NULL; | 180 Shell* Shell::instance_ = NULL; |
170 // static | 181 // static |
171 bool Shell::initially_hide_cursor_ = false; | 182 bool Shell::initially_hide_cursor_ = false; |
172 | 183 |
173 //////////////////////////////////////////////////////////////////////////////// | 184 //////////////////////////////////////////////////////////////////////////////// |
174 // Shell, public: | 185 // Shell, public: |
175 | 186 |
176 // static | 187 // static |
177 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 188 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { |
178 CHECK(!instance_); | 189 CHECK(!instance_); |
179 instance_ = new Shell(delegate); | 190 instance_ = new Shell(init_params.delegate); |
180 instance_->Init(); | 191 instance_->Init(init_params); |
181 return instance_; | 192 return instance_; |
182 } | 193 } |
183 | 194 |
184 // static | 195 // static |
185 Shell* Shell::GetInstance() { | 196 Shell* Shell::GetInstance() { |
186 DCHECK(instance_); | 197 DCHECK(instance_); |
187 return instance_; | 198 return instance_; |
188 } | 199 } |
189 | 200 |
190 // static | 201 // static |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 #endif // defined(OS_CHROMEOS) | 801 #endif // defined(OS_CHROMEOS) |
791 | 802 |
792 #if defined(OS_CHROMEOS) | 803 #if defined(OS_CHROMEOS) |
793 PowerStatus::Shutdown(); | 804 PowerStatus::Shutdown(); |
794 #endif | 805 #endif |
795 | 806 |
796 DCHECK(instance_ == this); | 807 DCHECK(instance_ == this); |
797 instance_ = NULL; | 808 instance_ = NULL; |
798 } | 809 } |
799 | 810 |
800 void Shell::Init() { | 811 void Shell::Init(const ShellInitParams& init_params) { |
801 delegate_->PreInit(); | 812 delegate_->PreInit(); |
802 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 813 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
803 display_manager_->SetSecondDisplayMode(DisplayManager::VIRTUAL_KEYBOARD); | 814 display_manager_->SetSecondDisplayMode(DisplayManager::VIRTUAL_KEYBOARD); |
804 } | 815 } |
805 bool display_initialized = display_manager_->InitFromCommandLine(); | 816 bool display_initialized = display_manager_->InitFromCommandLine(); |
806 #if defined(OS_CHROMEOS) | 817 #if defined(OS_CHROMEOS) |
807 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 818 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
808 display_configurator_animation_.reset(new DisplayConfiguratorAnimation()); | 819 display_configurator_animation_.reset(new DisplayConfiguratorAnimation()); |
809 display_configurator_->AddObserver(display_configurator_animation_.get()); | 820 display_configurator_->AddObserver(display_configurator_animation_.get()); |
810 | 821 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 ::wm::FocusController* focus_controller = | 862 ::wm::FocusController* focus_controller = |
852 new ::wm::FocusController(new wm::AshFocusRules); | 863 new ::wm::FocusController(new wm::AshFocusRules); |
853 focus_client_.reset(focus_controller); | 864 focus_client_.reset(focus_controller); |
854 activation_client_ = focus_controller; | 865 activation_client_ = focus_controller; |
855 activation_client_->AddObserver(this); | 866 activation_client_->AddObserver(this); |
856 focus_cycler_.reset(new FocusCycler()); | 867 focus_cycler_.reset(new FocusCycler()); |
857 | 868 |
858 screen_position_controller_.reset(new ScreenPositionController); | 869 screen_position_controller_.reset(new ScreenPositionController); |
859 | 870 |
860 display_controller_->Start(); | 871 display_controller_->Start(); |
861 display_controller_->CreatePrimaryHost(); | 872 display_controller_->CreatePrimaryHost( |
| 873 ShellInitParamsToAshWindowTreeHostInitParams(init_params)); |
862 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); | 874 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); |
863 target_root_window_ = root_window; | 875 target_root_window_ = root_window; |
864 | 876 |
865 #if defined(OS_CHROMEOS) | 877 #if defined(OS_CHROMEOS) |
866 resolution_notification_controller_.reset( | 878 resolution_notification_controller_.reset( |
867 new ResolutionNotificationController); | 879 new ResolutionNotificationController); |
868 #endif | 880 #endif |
869 | 881 |
870 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); | 882 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
871 | 883 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 //////////////////////////////////////////////////////////////////////////////// | 1143 //////////////////////////////////////////////////////////////////////////////// |
1132 // Shell, aura::client::ActivationChangeObserver implementation: | 1144 // Shell, aura::client::ActivationChangeObserver implementation: |
1133 | 1145 |
1134 void Shell::OnWindowActivated(aura::Window* gained_active, | 1146 void Shell::OnWindowActivated(aura::Window* gained_active, |
1135 aura::Window* lost_active) { | 1147 aura::Window* lost_active) { |
1136 if (gained_active) | 1148 if (gained_active) |
1137 target_root_window_ = gained_active->GetRootWindow(); | 1149 target_root_window_ = gained_active->GetRootWindow(); |
1138 } | 1150 } |
1139 | 1151 |
1140 } // namespace ash | 1152 } // namespace ash |
OLD | NEW |