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/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
12 #include "ash/display/cursor_window_controller.h" | 12 #include "ash/display/cursor_window_controller.h" |
13 #include "ash/display/display_layout_store.h" | 13 #include "ash/display/display_layout_store.h" |
14 #include "ash/display/display_manager.h" | 14 #include "ash/display/display_manager.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/magnifier/magnification_controller.h" | 21 #include "ash/magnifier/magnification_controller.h" |
21 #include "ash/magnifier/partial_magnification_controller.h" | 22 #include "ash/magnifier/partial_magnification_controller.h" |
22 #include "ash/root_window_controller.h" | 23 #include "ash/root_window_controller.h" |
23 #include "ash/root_window_settings.h" | 24 #include "ash/root_window_settings.h" |
24 #include "ash/screen_util.h" | 25 #include "ash/screen_util.h" |
25 #include "ash/shell.h" | 26 #include "ash/shell.h" |
26 #include "ash/shell_delegate.h" | 27 #include "ash/shell_delegate.h" |
27 #include "ash/system/tray/system_tray.h" | 28 #include "ash/system/tray/system_tray.h" |
28 #include "ash/wm/coordinate_conversion.h" | 29 #include "ash/wm/coordinate_conversion.h" |
29 #include "ash/wm/window_util.h" | 30 #include "ash/wm/window_util.h" |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 GetDisplayManager()->GetDisplayInfo(display.id()); | 888 GetDisplayManager()->GetDisplayInfo(display.id()); |
888 AshWindowTreeHostInitParams params_with_bounds(init_params); | 889 AshWindowTreeHostInitParams params_with_bounds(init_params); |
889 params_with_bounds.initial_bounds = display_info.bounds_in_native(); | 890 params_with_bounds.initial_bounds = display_info.bounds_in_native(); |
890 params_with_bounds.offscreen = | 891 params_with_bounds.offscreen = |
891 display.id() == DisplayManager::kUnifiedDisplayId; | 892 display.id() == DisplayManager::kUnifiedDisplayId; |
892 AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(params_with_bounds); | 893 AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(params_with_bounds); |
893 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 894 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
894 if (!input_method_) { // Singleton input method instance for Ash. | 895 if (!input_method_) { // Singleton input method instance for Ash. |
895 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); | 896 input_method_ = ui::CreateInputMethod(this, host->GetAcceleratedWidget()); |
896 input_method_->OnFocus(); | 897 input_method_->OnFocus(); |
| 898 input_method_event_handler_.reset( |
| 899 new InputMethodEventHandler(input_method_.get())); |
897 } | 900 } |
898 host->SetSharedInputMethod(input_method_.get()); | 901 host->SetSharedInputMethod(input_method_.get()); |
| 902 ash_host->set_input_method_handler(input_method_event_handler_.get()); |
899 | 903 |
900 host->window()->SetName(base::StringPrintf( | 904 host->window()->SetName(base::StringPrintf( |
901 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", | 905 "%sRootWindow-%d", params_with_bounds.offscreen ? "Offscreen" : "", |
902 host_count++)); | 906 host_count++)); |
903 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name())); | 907 host->window()->SetTitle(base::UTF8ToUTF16(display_info.name())); |
904 host->compositor()->SetBackgroundColor(SK_ColorBLACK); | 908 host->compositor()->SetBackgroundColor(SK_ColorBLACK); |
905 // No need to remove our observer observer because the DisplayController | 909 // No need to remove our observer observer because the DisplayController |
906 // outlives the host. | 910 // outlives the host. |
907 host->AddObserver(this); | 911 host->AddObserver(this); |
908 InitRootWindowSettings(host->window())->display_id = display.id(); | 912 InitRootWindowSettings(host->window())->display_id = display.id(); |
(...skipping 15 matching lines...) Expand all Loading... |
924 Shell::GetInstance()->display_configurator_animation() | 928 Shell::GetInstance()->display_configurator_animation() |
925 ->StartFadeInAnimation(); | 929 ->StartFadeInAnimation(); |
926 #endif | 930 #endif |
927 } | 931 } |
928 | 932 |
929 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { | 933 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { |
930 GetDisplayManager()->SetMirrorMode(mirror); | 934 GetDisplayManager()->SetMirrorMode(mirror); |
931 } | 935 } |
932 | 936 |
933 } // namespace ash | 937 } // namespace ash |
OLD | NEW |