Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: ash/display/virtual_keyboard_window_controller.cc

Issue 47873003: Add a full screen virtual keyboard to virtual keyboard root window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/host/root_window_host_factory.h" 10 #include "ash/host/root_window_host_factory.h"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/root_window_settings.h" 12 #include "ash/root_window_settings.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
18 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
19 #include "ui/keyboard/keyboard_controller.h"
19 20
20 namespace ash { 21 namespace ash {
21 namespace internal { 22 namespace internal {
22 23
23 VirtualKeyboardWindowController::VirtualKeyboardWindowController() { 24 VirtualKeyboardWindowController::VirtualKeyboardWindowController() {
24 } 25 }
25 26
26 VirtualKeyboardWindowController::~VirtualKeyboardWindowController() { 27 VirtualKeyboardWindowController::~VirtualKeyboardWindowController() {
27 // Make sure the root window gets deleted before cursor_window_delegate. 28 // Make sure the root window gets deleted before cursor_window_delegate.
28 Close(); 29 Close();
29 } 30 }
30 31
32 void VirtualKeyboardWindowController::ActivateKeyboard(
33 keyboard::KeyboardController* keyboard_controller) {
34 root_window_controller_->ActivateKeyboard(keyboard_controller);
35 }
36
31 void VirtualKeyboardWindowController::UpdateWindow( 37 void VirtualKeyboardWindowController::UpdateWindow(
32 const DisplayInfo& display_info) { 38 const DisplayInfo& display_info) {
33 static int virtual_keyboard_root_window_count = 0; 39 static int virtual_keyboard_root_window_count = 0;
34 if (!root_window_controller_.get()) { 40 if (!root_window_controller_.get()) {
35 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); 41 const gfx::Rect& bounds_in_native = display_info.bounds_in_native();
36 aura::RootWindow::CreateParams params(bounds_in_native); 42 aura::RootWindow::CreateParams params(bounds_in_native);
37 params.host = Shell::GetInstance()->root_window_host_factory()-> 43 params.host = Shell::GetInstance()->root_window_host_factory()->
38 CreateRootWindowHost(bounds_in_native); 44 CreateRootWindowHost(bounds_in_native);
39 aura::RootWindow* root_window = new aura::RootWindow(params); 45 aura::RootWindow* root_window = new aura::RootWindow(params);
40 46
41 root_window->window()->SetName( 47 root_window->window()->SetName(
42 base::StringPrintf("VirtualKeyboardRootWindow-%d", 48 base::StringPrintf("VirtualKeyboardRootWindow-%d",
43 virtual_keyboard_root_window_count++)); 49 virtual_keyboard_root_window_count++));
44 50
45 // No need to remove RootWindowObserver because 51 // No need to remove RootWindowObserver because
46 // the DisplayController object outlives RootWindow objects. 52 // the DisplayController object outlives RootWindow objects.
47 root_window->AddRootWindowObserver( 53 root_window->AddRootWindowObserver(
48 Shell::GetInstance()->display_controller()); 54 Shell::GetInstance()->display_controller());
49 InitRootWindowSettings(root_window->window())->display_id = 55 InitRootWindowSettings(root_window->window())->display_id =
50 display_info.id(); 56 display_info.id();
51 root_window->Init(); 57 root_window->Init();
52 RootWindowController::CreateForVirtualKeyboardDisplay(root_window); 58 RootWindowController::CreateForVirtualKeyboardDisplay(root_window);
53 root_window_controller_.reset(GetRootWindowController( 59 root_window_controller_.reset(GetRootWindowController(
54 root_window->window())); 60 root_window->window()));
55 root_window_controller_->dispatcher()->host()->Show(); 61 root_window_controller_->dispatcher()->host()->Show();
62 root_window_controller_->ActivateKeyboard(
63 Shell::GetInstance()->keyboard_controller());
56 } else { 64 } else {
57 aura::RootWindow* root_window = root_window_controller_->dispatcher(); 65 aura::RootWindow* root_window = root_window_controller_->dispatcher();
58 GetRootWindowSettings(root_window->window())->display_id = 66 GetRootWindowSettings(root_window->window())->display_id =
59 display_info.id(); 67 display_info.id();
60 root_window->SetHostBounds(display_info.bounds_in_native()); 68 root_window->SetHostBounds(display_info.bounds_in_native());
61 } 69 }
62 } 70 }
63 71
64 void VirtualKeyboardWindowController::Close() { 72 void VirtualKeyboardWindowController::Close() {
65 if (root_window_controller_.get()) { 73 if (root_window_controller_.get()) {
66 root_window_controller_->dispatcher()->RemoveRootWindowObserver( 74 root_window_controller_->dispatcher()->RemoveRootWindowObserver(
67 Shell::GetInstance()->display_controller()); 75 Shell::GetInstance()->display_controller());
68 root_window_controller_->Shutdown(); 76 root_window_controller_->Shutdown();
69 root_window_controller_.reset(); 77 root_window_controller_.reset();
70 } 78 }
71 } 79 }
72 80
73 } // namespace internal 81 } // namespace internal
74 } // namespace ash 82 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/virtual_keyboard_window_controller.h ('k') | ash/display/virtual_keyboard_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698