| 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/display/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
| 14 #include "ash/display/cursor_window_controller.h" | 14 #include "ash/display/cursor_window_controller.h" |
| 15 #include "ash/display/mirror_window_controller.h" | 15 #include "ash/display/mirror_window_controller.h" |
| 16 #include "ash/display/root_window_transformers.h" | 16 #include "ash/display/root_window_transformers.h" |
| 17 #include "ash/host/ash_window_tree_host.h" | 17 #include "ash/host/ash_window_tree_host.h" |
| 18 #include "ash/host/ash_window_tree_host_init_params.h" | 18 #include "ash/host/ash_window_tree_host_init_params.h" |
| 19 #include "ash/host/root_window_transformer.h" | 19 #include "ash/host/root_window_transformer.h" |
| 20 #include "ash/ime/input_method_event_handler.h" | 20 #include "ash/ime/input_method_event_handler.h" |
| 21 #include "ash/magnifier/magnification_controller.h" | 21 #include "ash/magnifier/magnification_controller.h" |
| 22 #include "ash/magnifier/partial_magnification_controller.h" | 22 #include "ash/magnifier/partial_magnification_controller.h" |
| 23 #include "ash/public/cpp/config.h" |
| 23 #include "ash/root_window_controller.h" | 24 #include "ash/root_window_controller.h" |
| 24 #include "ash/root_window_settings.h" | 25 #include "ash/root_window_settings.h" |
| 25 #include "ash/shell.h" | 26 #include "ash/shell.h" |
| 26 #include "ash/system/tray/system_tray.h" | 27 #include "ash/system/tray/system_tray.h" |
| 27 #include "ash/wm/window_util.h" | 28 #include "ash/wm/window_util.h" |
| 28 #include "base/command_line.h" | 29 #include "base/command_line.h" |
| 29 #include "base/strings/stringprintf.h" | 30 #include "base/strings/stringprintf.h" |
| 30 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| 31 #include "base/threading/thread_task_runner_handle.h" | 32 #include "base/threading/thread_task_runner_handle.h" |
| 32 #include "ui/aura/client/capture_client.h" | 33 #include "ui/aura/client/capture_client.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 params_with_bounds.offscreen = | 817 params_with_bounds.offscreen = |
| 817 display.id() == display::DisplayManager::kUnifiedDisplayId; | 818 display.id() == display::DisplayManager::kUnifiedDisplayId; |
| 818 params_with_bounds.display_id = display.id(); | 819 params_with_bounds.display_id = display.id(); |
| 819 params_with_bounds.device_scale_factor = display.device_scale_factor(); | 820 params_with_bounds.device_scale_factor = display.device_scale_factor(); |
| 820 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale(); | 821 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale(); |
| 821 // The AshWindowTreeHost ends up owned by the RootWindowControllers created | 822 // The AshWindowTreeHost ends up owned by the RootWindowControllers created |
| 822 // by this class. | 823 // by this class. |
| 823 AshWindowTreeHost* ash_host = | 824 AshWindowTreeHost* ash_host = |
| 824 AshWindowTreeHost::Create(params_with_bounds).release(); | 825 AshWindowTreeHost::Create(params_with_bounds).release(); |
| 825 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 826 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| 826 // TODO: Config::MUS should not install an InputMethod. | 827 // In mash input method is hosted by the browser process, so we don't need to |
| 827 // http://crbug.com/706913 | 828 // create and set it here. |
| 828 if (!host->has_input_method()) { | 829 if (Shell::GetAshConfig() != Config::MASH) { |
| 830 DCHECK(!host->has_input_method()); |
| 829 if (!input_method_) { // Singleton input method instance for Ash. | 831 if (!input_method_) { // Singleton input method instance for Ash. |
| 830 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); | 832 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); |
| 831 // Makes sure the input method is focused by default when created, because | 833 // Makes sure the input method is focused by default when created, because |
| 832 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when | 834 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when |
| 833 // the active window changed. | 835 // the active window changed. |
| 834 input_method_->OnFocus(); | 836 input_method_->OnFocus(); |
| 835 input_method_event_handler_.reset( | 837 input_method_event_handler_.reset( |
| 836 new InputMethodEventHandler(input_method_.get())); | 838 new InputMethodEventHandler(input_method_.get())); |
| 837 } | 839 } |
| 838 host->SetSharedInputMethod(input_method_.get()); | 840 host->SetSharedInputMethod(input_method_.get()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 853 | 855 |
| 854 window_tree_hosts_[display.id()] = ash_host; | 856 window_tree_hosts_[display.id()] = ash_host; |
| 855 SetDisplayPropertiesOnHost(ash_host, display); | 857 SetDisplayPropertiesOnHost(ash_host, display); |
| 856 | 858 |
| 857 if (switches::ConstrainPointerToRoot()) | 859 if (switches::ConstrainPointerToRoot()) |
| 858 ash_host->ConfineCursorToRootWindow(); | 860 ash_host->ConfineCursorToRootWindow(); |
| 859 return ash_host; | 861 return ash_host; |
| 860 } | 862 } |
| 861 | 863 |
| 862 } // namespace ash | 864 } // namespace ash |
| OLD | NEW |