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

Side by Side Diff: ui/keyboard/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 | « ui/keyboard/content/keyboard_ui_content.cc ('k') | ui/keyboard/keyboard_layout_manager.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (keyboard::IsKeyboardOverscrollEnabled()) 239 if (keyboard::IsKeyboardOverscrollEnabled())
240 ui_->InitInsets(new_bounds); 240 ui_->InitInsets(new_bounds);
241 else 241 else
242 ui_->ResetInsets(); 242 ui_->ResetInsets();
243 } else { 243 } else {
244 current_keyboard_bounds_ = gfx::Rect(); 244 current_keyboard_bounds_ = gfx::Rect();
245 } 245 }
246 } 246 }
247 247
248 void KeyboardController::HideKeyboard(HideReason reason) { 248 void KeyboardController::HideKeyboard(HideReason reason) {
249 TRACE_EVENT0("vk", "HideKeyboard");
250
249 keyboard_visible_ = false; 251 keyboard_visible_ = false;
250 ToggleTouchEventLogging(true); 252 ToggleTouchEventLogging(true);
251 253
252 keyboard::LogKeyboardControlEvent( 254 keyboard::LogKeyboardControlEvent(
253 reason == HIDE_REASON_AUTOMATIC ? 255 reason == HIDE_REASON_AUTOMATIC ?
254 keyboard::KEYBOARD_CONTROL_HIDE_AUTO : 256 keyboard::KEYBOARD_CONTROL_HIDE_AUTO :
255 keyboard::KEYBOARD_CONTROL_HIDE_USER); 257 keyboard::KEYBOARD_CONTROL_HIDE_USER);
256 258
257 NotifyKeyboardBoundsChanging(gfx::Rect()); 259 NotifyKeyboardBoundsChanging(gfx::Rect());
258 260
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 show_on_resize_ = false; 372 show_on_resize_ = false;
371 ui_->ReloadKeyboardIfNeeded(); 373 ui_->ReloadKeyboardIfNeeded();
372 } 374 }
373 } 375 }
374 376
375 void KeyboardController::OnTextInputStateChanged( 377 void KeyboardController::OnTextInputStateChanged(
376 const ui::TextInputClient* client) { 378 const ui::TextInputClient* client) {
377 if (!container_.get()) 379 if (!container_.get())
378 return; 380 return;
379 381
382 TRACE_EVENT0("vk", "OnTextInputStateChanged");
383
380 ui::TextInputType type = 384 ui::TextInputType type =
381 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; 385 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
382 386
383 if (type == ui::TEXT_INPUT_TYPE_NONE && !keyboard_locked_) { 387 if (type == ui::TEXT_INPUT_TYPE_NONE && !keyboard_locked_) {
384 if (keyboard_visible_) { 388 if (keyboard_visible_) {
385 // Set the visibility state here so that any queries for visibility 389 // Set the visibility state here so that any queries for visibility
386 // before the timer fires returns the correct future value. 390 // before the timer fires returns the correct future value.
387 keyboard_visible_ = false; 391 keyboard_visible_ = false;
388 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 392 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
389 FROM_HERE, 393 FROM_HERE,
(...skipping 26 matching lines...) Expand all
416 // Calling |ShowKeyboardInternal| may move the keyboard to another display. 420 // Calling |ShowKeyboardInternal| may move the keyboard to another display.
417 if (IsKeyboardEnabled() && !keyboard_locked()) 421 if (IsKeyboardEnabled() && !keyboard_locked())
418 ShowKeyboardInternal(display::kInvalidDisplayId); 422 ShowKeyboardInternal(display::kInvalidDisplayId);
419 } 423 }
420 424
421 void KeyboardController::ShowKeyboardInternal(int64_t display_id) { 425 void KeyboardController::ShowKeyboardInternal(int64_t display_id) {
422 // The container window should have been created already when 426 // The container window should have been created already when
423 // |Shell::CreateKeyboard| is called. 427 // |Shell::CreateKeyboard| is called.
424 DCHECK(container_.get()); 428 DCHECK(container_.get());
425 429
430 TRACE_EVENT0("vk", "ShowKeyboardInternal");
431
426 if (container_->children().empty()) { 432 if (container_->children().empty()) {
427 keyboard::MarkKeyboardLoadStarted(); 433 keyboard::MarkKeyboardLoadStarted();
428 aura::Window* keyboard = ui_->GetKeyboardWindow(); 434 aura::Window* keyboard = ui_->GetKeyboardWindow();
429 keyboard->Show(); 435 keyboard->Show();
430 container_->AddChild(keyboard); 436 container_->AddChild(keyboard);
431 keyboard->set_owned_by_parent(false); 437 keyboard->set_owned_by_parent(false);
432 } 438 }
433 439
434 ui_->ReloadKeyboardIfNeeded(); 440 ui_->ReloadKeyboardIfNeeded();
435 441
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 int keyboard_height = GetContainerWindow()->bounds().height(); 541 int keyboard_height = GetContainerWindow()->bounds().height();
536 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); 542 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds();
537 gfx::Rect new_bounds = root_bounds; 543 gfx::Rect new_bounds = root_bounds;
538 new_bounds.set_y(root_bounds.height() - keyboard_height); 544 new_bounds.set_y(root_bounds.height() - keyboard_height);
539 new_bounds.set_height(keyboard_height); 545 new_bounds.set_height(keyboard_height);
540 GetContainerWindow()->SetBounds(new_bounds); 546 GetContainerWindow()->SetBounds(new_bounds);
541 } 547 }
542 } 548 }
543 549
544 } // namespace keyboard 550 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/content/keyboard_ui_content.cc ('k') | ui/keyboard/keyboard_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698