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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 2923493002: Add TRACE_EVENT markers to various keyboard functions (Closed)
Patch Set: more trace markers Created 3 years, 6 months 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
« no previous file with comments | « no previous file | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/virtual_keyboard_controller.h" 5 #include "ash/virtual_keyboard_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/keyboard/keyboard_ui.h" 9 #include "ash/keyboard/keyboard_ui.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 16 matching lines...) Expand all
27 namespace { 27 namespace {
28 28
29 // Checks whether smart deployment is enabled. 29 // Checks whether smart deployment is enabled.
30 bool IsSmartVirtualKeyboardEnabled() { 30 bool IsSmartVirtualKeyboardEnabled() {
31 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 31 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
32 keyboard::switches::kEnableVirtualKeyboard); 32 keyboard::switches::kEnableVirtualKeyboard);
33 } 33 }
34 34
35 void MoveKeyboardToDisplayInternal(const int64_t display_id) { 35 void MoveKeyboardToDisplayInternal(const int64_t display_id) {
36 // Remove the keyboard from curent root window controller 36 // Remove the keyboard from curent root window controller
37 TRACE_EVENT0("vk", "MoveKeyboardToDisplayInternal");
37 Shell::Get()->keyboard_ui()->Hide(); 38 Shell::Get()->keyboard_ui()->Hide();
38 RootWindowController::ForWindow( 39 RootWindowController::ForWindow(
39 keyboard::KeyboardController::GetInstance()->GetContainerWindow()) 40 keyboard::KeyboardController::GetInstance()->GetContainerWindow())
40 ->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); 41 ->DeactivateKeyboard(keyboard::KeyboardController::GetInstance());
41 42
42 for (RootWindowController* controller : 43 for (RootWindowController* controller :
43 Shell::Get()->GetAllRootWindowControllers()) { 44 Shell::Get()->GetAllRootWindowControllers()) {
44 if (display::Screen::GetScreen() 45 if (display::Screen::GetScreen()
45 ->GetDisplayNearestWindow(controller->GetRootWindow()) 46 ->GetDisplayNearestWindow(controller->GetRootWindow())
46 .id() == display_id) { 47 .id() == display_id) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 void VirtualKeyboardController::ToggleIgnoreExternalKeyboard() { 106 void VirtualKeyboardController::ToggleIgnoreExternalKeyboard() {
106 ignore_external_keyboard_ = !ignore_external_keyboard_; 107 ignore_external_keyboard_ = !ignore_external_keyboard_;
107 UpdateKeyboardEnabled(); 108 UpdateKeyboardEnabled();
108 } 109 }
109 110
110 void VirtualKeyboardController::MoveKeyboardToDisplay(int64_t display_id) { 111 void VirtualKeyboardController::MoveKeyboardToDisplay(int64_t display_id) {
111 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr); 112 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr);
112 DCHECK(display_id != display::kInvalidDisplayId); 113 DCHECK(display_id != display::kInvalidDisplayId);
113 114
115 TRACE_EVENT0("vk", "MoveKeyboardToDisplay");
116
114 aura::Window* container = 117 aura::Window* container =
115 keyboard::KeyboardController::GetInstance()->GetContainerWindow(); 118 keyboard::KeyboardController::GetInstance()->GetContainerWindow();
116 DCHECK(container != nullptr); 119 DCHECK(container != nullptr);
117 const display::Screen* screen = display::Screen::GetScreen(); 120 const display::Screen* screen = display::Screen::GetScreen();
118 const display::Display current_display = 121 const display::Display current_display =
119 screen->GetDisplayNearestWindow(container); 122 screen->GetDisplayNearestWindow(container);
120 123
121 if (display_id != current_display.id()) 124 if (display_id != current_display.id())
122 MoveKeyboardToDisplayInternal(display_id); 125 MoveKeyboardToDisplayInternal(display_id);
123 } 126 }
124 127
125 void VirtualKeyboardController::MoveKeyboardToTouchableDisplay() { 128 void VirtualKeyboardController::MoveKeyboardToTouchableDisplay() {
126 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr); 129 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr);
127 130
131 TRACE_EVENT0("vk", "MoveKeyboardToTouchableDisplay");
132
128 aura::Window* container = 133 aura::Window* container =
129 keyboard::KeyboardController::GetInstance()->GetContainerWindow(); 134 keyboard::KeyboardController::GetInstance()->GetContainerWindow();
130 DCHECK(container != nullptr); 135 DCHECK(container != nullptr);
131 136
132 const display::Screen* screen = display::Screen::GetScreen(); 137 const display::Screen* screen = display::Screen::GetScreen();
133 const display::Display current_display = 138 const display::Display current_display =
134 screen->GetDisplayNearestWindow(container); 139 screen->GetDisplayNearestWindow(container);
135 140
136 if (wm::GetFocusedWindow() != nullptr) { 141 if (wm::GetFocusedWindow() != nullptr) {
137 // Move the virtual keyboard to the focused display if that display has 142 // Move the virtual keyboard to the focused display if that display has
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (is_enabled == was_enabled) 210 if (is_enabled == was_enabled)
206 return; 211 return;
207 if (is_enabled) { 212 if (is_enabled) {
208 Shell::Get()->CreateKeyboard(); 213 Shell::Get()->CreateKeyboard();
209 } else { 214 } else {
210 Shell::Get()->DeactivateKeyboard(); 215 Shell::Get()->DeactivateKeyboard();
211 } 216 }
212 } 217 }
213 218
214 } // namespace ash 219 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698