| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 AshWindowTreeHost* WindowTreeHostManager::AddWindowTreeHostForDisplay( | 806 AshWindowTreeHost* WindowTreeHostManager::AddWindowTreeHostForDisplay( |
| 807 const display::Display& display, | 807 const display::Display& display, |
| 808 const AshWindowTreeHostInitParams& init_params) { | 808 const AshWindowTreeHostInitParams& init_params) { |
| 809 static int host_count = 0; | 809 static int host_count = 0; |
| 810 const display::ManagedDisplayInfo& display_info = | 810 const display::ManagedDisplayInfo& display_info = |
| 811 GetDisplayManager()->GetDisplayInfo(display.id()); | 811 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 812 AshWindowTreeHostInitParams params_with_bounds(init_params); | 812 AshWindowTreeHostInitParams params_with_bounds(init_params); |
| 813 params_with_bounds.initial_bounds = display_info.bounds_in_native(); | 813 params_with_bounds.initial_bounds = display_info.bounds_in_native(); |
| 814 params_with_bounds.offscreen = | 814 params_with_bounds.offscreen = |
| 815 display.id() == display::DisplayManager::kUnifiedDisplayId; | 815 display.id() == display::DisplayManager::kUnifiedDisplayId; |
| 816 AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(params_with_bounds); | 816 // The AshWindowTreeHost ends up owned by the RootWindowControllers created |
| 817 // by this class. |
| 818 AshWindowTreeHost* ash_host = |
| 819 AshWindowTreeHost::Create(params_with_bounds).release(); |
| 817 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 820 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| 818 if (!input_method_) { // Singleton input method instance for Ash. | 821 if (!input_method_) { // Singleton input method instance for Ash. |
| 819 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); | 822 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); |
| 820 // Makes sure the input method is focused by default when created, because | 823 // Makes sure the input method is focused by default when created, because |
| 821 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when the | 824 // Ash uses singleton InputMethod and it won't call OnFocus/OnBlur when the |
| 822 // active window changed. | 825 // active window changed. |
| 823 input_method_->OnFocus(); | 826 input_method_->OnFocus(); |
| 824 input_method_event_handler_.reset( | 827 input_method_event_handler_.reset( |
| 825 new InputMethodEventHandler(input_method_.get())); | 828 new InputMethodEventHandler(input_method_.get())); |
| 826 } | 829 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 841 | 844 |
| 842 window_tree_hosts_[display.id()] = ash_host; | 845 window_tree_hosts_[display.id()] = ash_host; |
| 843 SetDisplayPropertiesOnHost(ash_host, display); | 846 SetDisplayPropertiesOnHost(ash_host, display); |
| 844 | 847 |
| 845 if (switches::ConstrainPointerToRoot()) | 848 if (switches::ConstrainPointerToRoot()) |
| 846 ash_host->ConfineCursorToRootWindow(); | 849 ash_host->ConfineCursorToRootWindow(); |
| 847 return ash_host; | 850 return ash_host; |
| 848 } | 851 } |
| 849 | 852 |
| 850 } // namespace ash | 853 } // namespace ash |
| OLD | NEW |