| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/virtual_keyboard_window_controller.h" | 5 #include "ash/display/virtual_keyboard_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/root_window_transformers.h" | 10 #include "ash/display/root_window_transformers.h" |
| 11 #include "ash/host/ash_window_tree_host.h" | 11 #include "ash/host/ash_window_tree_host.h" |
| 12 #include "ash/host/ash_window_tree_host_init_params.h" |
| 12 #include "ash/host/root_window_transformer.h" | 13 #include "ash/host/root_window_transformer.h" |
| 13 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 14 #include "ash/root_window_settings.h" | 15 #include "ash/root_window_settings.h" |
| 15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 16 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 19 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
| 20 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 21 #include "ui/keyboard/keyboard_controller.h" | 22 #include "ui/keyboard/keyboard_controller.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 | 36 |
| 36 void VirtualKeyboardWindowController::ActivateKeyboard( | 37 void VirtualKeyboardWindowController::ActivateKeyboard( |
| 37 keyboard::KeyboardController* keyboard_controller) { | 38 keyboard::KeyboardController* keyboard_controller) { |
| 38 root_window_controller_->ActivateKeyboard(keyboard_controller); | 39 root_window_controller_->ActivateKeyboard(keyboard_controller); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void VirtualKeyboardWindowController::UpdateWindow( | 42 void VirtualKeyboardWindowController::UpdateWindow( |
| 42 const DisplayInfo& display_info) { | 43 const DisplayInfo& display_info) { |
| 43 static int virtual_keyboard_host_count = 0; | 44 static int virtual_keyboard_host_count = 0; |
| 44 if (!root_window_controller_.get()) { | 45 if (!root_window_controller_.get()) { |
| 45 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); | 46 AshWindowTreeHostInitParams init_params; |
| 46 AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(bounds_in_native); | 47 init_params.initial_bounds = display_info.bounds_in_native(); |
| 48 AshWindowTreeHost* ash_host = AshWindowTreeHost::Create(init_params); |
| 47 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 49 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| 48 | 50 |
| 49 host->window()->SetName(base::StringPrintf("VirtualKeyboardRootWindow-%d", | 51 host->window()->SetName(base::StringPrintf("VirtualKeyboardRootWindow-%d", |
| 50 virtual_keyboard_host_count++)); | 52 virtual_keyboard_host_count++)); |
| 51 | 53 |
| 52 // No need to remove WindowTreeHostObserver because the DisplayController | 54 // No need to remove WindowTreeHostObserver because the DisplayController |
| 53 // outlives the host. | 55 // outlives the host. |
| 54 host->AddObserver(Shell::GetInstance()->display_controller()); | 56 host->AddObserver(Shell::GetInstance()->display_controller()); |
| 55 InitRootWindowSettings(host->window())->display_id = display_info.id(); | 57 InitRootWindowSettings(host->window())->display_id = display_info.id(); |
| 56 host->InitHost(); | 58 host->InitHost(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 Shell::GetInstance()->CreateKeyboard(); | 101 Shell::GetInstance()->CreateKeyboard(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void VirtualKeyboardWindowController::OnMaximizeModeEnded() { | 104 void VirtualKeyboardWindowController::OnMaximizeModeEnded() { |
| 103 keyboard::SetTouchKeyboardEnabled(false); | 105 keyboard::SetTouchKeyboardEnabled(false); |
| 104 if (!keyboard::IsKeyboardEnabled()) | 106 if (!keyboard::IsKeyboardEnabled()) |
| 105 Shell::GetInstance()->DeactivateKeyboard(); | 107 Shell::GetInstance()->DeactivateKeyboard(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace ash | 110 } // namespace ash |
| OLD | NEW |