| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/accelerators/accelerator_controller.h" | 11 #include "ash/accelerators/accelerator_controller.h" |
| 12 #include "ash/accelerators/accelerator_delegate.h" | 12 #include "ash/accelerators/accelerator_delegate.h" |
| 13 #include "ash/accelerators/ash_focus_manager_factory.h" | 13 #include "ash/accelerators/ash_focus_manager_factory.h" |
| 14 #include "ash/accelerators/magnifier_key_scroller.h" | 14 #include "ash/accelerators/magnifier_key_scroller.h" |
| 15 #include "ash/accelerators/spoken_feedback_toggler.h" | 15 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 16 #include "ash/accessibility_delegate.h" | 16 #include "ash/accessibility_delegate.h" |
| 17 #include "ash/app_list/app_list_delegate_impl.h" | 17 #include "ash/app_list/app_list_delegate_impl.h" |
| 18 #include "ash/ash_constants.h" | 18 #include "ash/ash_constants.h" |
| 19 #include "ash/ash_switches.h" |
| 19 #include "ash/aura/shell_port_classic.h" | 20 #include "ash/aura/shell_port_classic.h" |
| 20 #include "ash/autoclick/autoclick_controller.h" | 21 #include "ash/autoclick/autoclick_controller.h" |
| 21 #include "ash/cast_config_controller.h" | 22 #include "ash/cast_config_controller.h" |
| 22 #include "ash/devtools/ash_devtools_css_agent.h" | 23 #include "ash/devtools/ash_devtools_css_agent.h" |
| 23 #include "ash/devtools/ash_devtools_dom_agent.h" | 24 #include "ash/devtools/ash_devtools_dom_agent.h" |
| 24 #include "ash/display/cursor_window_controller.h" | 25 #include "ash/display/cursor_window_controller.h" |
| 25 #include "ash/display/display_color_manager_chromeos.h" | 26 #include "ash/display/display_color_manager_chromeos.h" |
| 26 #include "ash/display/display_configuration_controller.h" | 27 #include "ash/display/display_configuration_controller.h" |
| 27 #include "ash/display/display_error_observer_chromeos.h" | 28 #include "ash/display/display_error_observer_chromeos.h" |
| 28 #include "ash/display/event_transformation_handler.h" | 29 #include "ash/display/event_transformation_handler.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 const aura::Window* Shell::GetContainer(const aura::Window* root_window, | 303 const aura::Window* Shell::GetContainer(const aura::Window* root_window, |
| 303 int container_id) { | 304 int container_id) { |
| 304 return root_window->GetChildById(container_id); | 305 return root_window->GetChildById(container_id); |
| 305 } | 306 } |
| 306 | 307 |
| 307 // static | 308 // static |
| 308 Config Shell::GetAshConfig() { | 309 Config Shell::GetAshConfig() { |
| 309 return Get()->shell_port_->GetAshConfig(); | 310 return Get()->shell_port_->GetAshConfig(); |
| 310 } | 311 } |
| 311 | 312 |
| 313 // static |
| 314 bool Shell::ShouldUseIMEService() { |
| 315 return Shell::GetAshConfig() == Config::MASH || |
| 316 (Shell::GetAshConfig() == Config::MUS && |
| 317 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 318 switches::kUseIMEService)); |
| 319 } |
| 320 |
| 312 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( | 321 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( |
| 313 views::Widget* widget) { | 322 views::Widget* widget) { |
| 314 // Use translucent-style window frames for dialogs. | 323 // Use translucent-style window frames for dialogs. |
| 315 return new CustomFrameViewAsh(widget); | 324 return new CustomFrameViewAsh(widget); |
| 316 } | 325 } |
| 317 | 326 |
| 318 void Shell::SetDisplayWorkAreaInsets(Window* contains, | 327 void Shell::SetDisplayWorkAreaInsets(Window* contains, |
| 319 const gfx::Insets& insets) { | 328 const gfx::Insets& insets) { |
| 320 shell_port_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets); | 329 shell_port_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets); |
| 321 } | 330 } |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 937 } |
| 929 | 938 |
| 930 if (cursor_manager_) { | 939 if (cursor_manager_) { |
| 931 cursor_manager_->SetDisplay( | 940 cursor_manager_->SetDisplay( |
| 932 display::Screen::GetScreen()->GetPrimaryDisplay()); | 941 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 933 } | 942 } |
| 934 | 943 |
| 935 accelerator_controller_ = shell_port_->CreateAcceleratorController(); | 944 accelerator_controller_ = shell_port_->CreateAcceleratorController(); |
| 936 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); | 945 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); |
| 937 | 946 |
| 938 if (config == Config::CLASSIC || config == Config::MUS) { | 947 if (!ShouldUseIMEService()) { |
| 939 // Not applicable to mash as events are already routed to InputMethod first. | 948 // Not applicable when using IME service as events are already routed to |
| 949 // InputMethod first. |
| 940 AddPreTargetHandler( | 950 AddPreTargetHandler( |
| 941 window_tree_host_manager_->input_method_event_handler()); | 951 window_tree_host_manager_->input_method_event_handler()); |
| 942 } | 952 } |
| 943 | 953 |
| 944 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 954 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
| 945 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 955 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
| 946 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); | 956 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); |
| 947 AddPreTargetHandler(speech_feedback_handler_.get()); | 957 AddPreTargetHandler(speech_feedback_handler_.get()); |
| 948 | 958 |
| 949 // The order in which event filters are added is significant. | 959 // The order in which event filters are added is significant. |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 void Shell::OnPrefServiceInitialized( | 1253 void Shell::OnPrefServiceInitialized( |
| 1244 std::unique_ptr<::PrefService> pref_service) { | 1254 std::unique_ptr<::PrefService> pref_service) { |
| 1245 if (!instance_) | 1255 if (!instance_) |
| 1246 return; | 1256 return; |
| 1247 // |pref_service_| is null if can't connect to Chrome (as happens when | 1257 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1248 // running mash outside of chrome --mash and chrome isn't built). | 1258 // running mash outside of chrome --mash and chrome isn't built). |
| 1249 pref_service_ = std::move(pref_service); | 1259 pref_service_ = std::move(pref_service); |
| 1250 } | 1260 } |
| 1251 | 1261 |
| 1252 } // namespace ash | 1262 } // namespace ash |
| OLD | NEW |