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

Side by Side Diff: ui/keyboard/keyboard_ui.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 | « ui/keyboard/keyboard_layout_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/keyboard/keyboard_ui.h" 5 #include "ui/keyboard/keyboard_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/base/ime/input_method.h" 9 #include "ui/base/ime/input_method.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
11 #include "ui/base/ui_base_switches.h" 11 #include "ui/base/ui_base_switches.h"
12 #include "ui/keyboard/keyboard_controller.h" 12 #include "ui/keyboard/keyboard_controller.h"
13 13
14 namespace keyboard { 14 namespace keyboard {
15 15
16 KeyboardUI::KeyboardUI() : keyboard_controller_(nullptr) {} 16 KeyboardUI::KeyboardUI() : keyboard_controller_(nullptr) {}
17 KeyboardUI::~KeyboardUI() {} 17 KeyboardUI::~KeyboardUI() {}
18 18
19 void KeyboardUI::ShowKeyboardContainer(aura::Window* container) { 19 void KeyboardUI::ShowKeyboardContainer(aura::Window* container) {
20 if (HasKeyboardWindow()) { 20 if (HasKeyboardWindow()) {
21 GetKeyboardWindow()->Show(); 21 {
22 container->Show(); 22 TRACE_EVENT0("vk", "ShowKeyboardContainerWindow");
23 GetKeyboardWindow()->Show();
24 }
25 {
26 TRACE_EVENT0("vk", "ShowKeyboardContainer");
27 container->Show();
28 }
23 } 29 }
24 } 30 }
25 31
26 void KeyboardUI::HideKeyboardContainer(aura::Window* container) { 32 void KeyboardUI::HideKeyboardContainer(aura::Window* container) {
27 if (HasKeyboardWindow()) { 33 if (HasKeyboardWindow()) {
28 container->Hide(); 34 container->Hide();
29 GetKeyboardWindow()->Hide(); 35 GetKeyboardWindow()->Hide();
30 } 36 }
31 } 37 }
32 38
33 void KeyboardUI::EnsureCaretInWorkArea() { 39 void KeyboardUI::EnsureCaretInWorkArea() {
34 if (!GetInputMethod()) 40 if (!GetInputMethod())
35 return; 41 return;
36 42
43 TRACE_EVENT0("vk", "EnsureCaretInWorkArea");
44
37 const aura::Window* keyboard_window = GetKeyboardWindow(); 45 const aura::Window* keyboard_window = GetKeyboardWindow();
38 const gfx::Rect keyboard_bounds_in_screen = 46 const gfx::Rect keyboard_bounds_in_screen =
39 keyboard_window->IsVisible() ? keyboard_window->GetBoundsInScreen() 47 keyboard_window->IsVisible() ? keyboard_window->GetBoundsInScreen()
40 : gfx::Rect(); 48 : gfx::Rect();
41 49
42 // Use new virtual keyboard behavior only if the flag enabled and in 50 // Use new virtual keyboard behavior only if the flag enabled and in
43 // non-sticky mode. 51 // non-sticky mode.
44 const bool new_vk_behavior = 52 const bool new_vk_behavior =
45 (!base::CommandLine::ForCurrentProcess()->HasSwitch( 53 (!base::CommandLine::ForCurrentProcess()->HasSwitch(
46 ::switches::kDisableNewVirtualKeyboardBehavior) && 54 ::switches::kDisableNewVirtualKeyboardBehavior) &&
47 !keyboard_controller_->keyboard_locked()); 55 !keyboard_controller_->keyboard_locked());
48 56
49 if (new_vk_behavior) { 57 if (new_vk_behavior) {
50 GetInputMethod()->SetOnScreenKeyboardBounds(keyboard_bounds_in_screen); 58 GetInputMethod()->SetOnScreenKeyboardBounds(keyboard_bounds_in_screen);
51 } else if (GetInputMethod()->GetTextInputClient()) { 59 } else if (GetInputMethod()->GetTextInputClient()) {
52 GetInputMethod()->GetTextInputClient()->EnsureCaretNotInRect( 60 GetInputMethod()->GetTextInputClient()->EnsureCaretNotInRect(
53 keyboard_bounds_in_screen); 61 keyboard_bounds_in_screen);
54 } 62 }
55 } 63 }
56 64
57 void KeyboardUI::SetController(KeyboardController* controller) { 65 void KeyboardUI::SetController(KeyboardController* controller) {
58 keyboard_controller_ = controller; 66 keyboard_controller_ = controller;
59 } 67 }
60 68
61 } // namespace keyboard 69 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698