Chromium Code Reviews| 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> |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 params_with_bounds.display_id = display.id(); | 819 params_with_bounds.display_id = display.id(); |
| 820 params_with_bounds.device_scale_factor = display.device_scale_factor(); | 820 params_with_bounds.device_scale_factor = display.device_scale_factor(); |
| 821 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale(); | 821 params_with_bounds.ui_scale_factor = display_info.configured_ui_scale(); |
| 822 // The AshWindowTreeHost ends up owned by the RootWindowControllers created | 822 // The AshWindowTreeHost ends up owned by the RootWindowControllers created |
| 823 // by this class. | 823 // by this class. |
| 824 AshWindowTreeHost* ash_host = | 824 AshWindowTreeHost* ash_host = |
| 825 AshWindowTreeHost::Create(params_with_bounds).release(); | 825 AshWindowTreeHost::Create(params_with_bounds).release(); |
| 826 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 826 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| 827 // In mash input method is hosted by the browser process, so we don't need to | 827 // In mash input method is hosted by the browser process, so we don't need to |
| 828 // create and set it here. | 828 // create and set it here. |
| 829 if (Shell::GetAshConfig() != Config::MASH) { | 829 if (Shell::GetAshConfig() != Config::MASH && !host->has_input_method()) { |
| 830 DCHECK(!host->has_input_method()); | |
|
sky
2017/05/05 14:22:36
It would be nice to keep this DCHECK. Otherwise if
Hadi
2017/05/05 14:51:57
Done. Also refactored the condition to Shell::UseI
| |
| 831 if (!input_method_) { // Singleton input method instance for Ash. | 830 if (!input_method_) { // Singleton input method instance for Ash. |
| 832 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); | 831 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); |
| 833 // Makes sure the input method is focused by default when created, because | 832 // Makes sure the input method is focused by default when created, because |
| 834 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when | 833 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when |
| 835 // the active window changed. | 834 // the active window changed. |
| 836 input_method_->OnFocus(); | 835 input_method_->OnFocus(); |
| 837 input_method_event_handler_.reset( | 836 input_method_event_handler_.reset( |
| 838 new InputMethodEventHandler(input_method_.get())); | 837 new InputMethodEventHandler(input_method_.get())); |
| 839 } | 838 } |
| 840 host->SetSharedInputMethod(input_method_.get()); | 839 host->SetSharedInputMethod(input_method_.get()); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 855 | 854 |
| 856 window_tree_hosts_[display.id()] = ash_host; | 855 window_tree_hosts_[display.id()] = ash_host; |
| 857 SetDisplayPropertiesOnHost(ash_host, display); | 856 SetDisplayPropertiesOnHost(ash_host, display); |
| 858 | 857 |
| 859 if (switches::ConstrainPointerToRoot()) | 858 if (switches::ConstrainPointerToRoot()) |
| 860 ash_host->ConfineCursorToRootWindow(); | 859 ash_host->ConfineCursorToRootWindow(); |
| 861 return ash_host; | 860 return ash_host; |
| 862 } | 861 } |
| 863 | 862 |
| 864 } // namespace ash | 863 } // namespace ash |
| OLD | NEW |