| OLD | NEW |
| 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_util.h" | 5 #include "ui/keyboard/keyboard_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } else { | 362 } else { |
| 363 ui::EventDispatchDetails details = | 363 ui::EventDispatchDetails details = |
| 364 host->event_sink()->OnEventFromSource(&event); | 364 host->event_sink()->OnEventFromSource(&event); |
| 365 CHECK(!details.dispatcher_destroyed); | 365 CHECK(!details.dispatcher_destroyed); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 return true; | 368 return true; |
| 369 } | 369 } |
| 370 | 370 |
| 371 void MarkKeyboardLoadStarted() { | 371 void MarkKeyboardLoadStarted() { |
| 372 if (!g_keyboard_load_time_start.Get().ToInternalValue()) | 372 if (g_keyboard_load_time_start.Get().is_null()) |
| 373 g_keyboard_load_time_start.Get() = base::Time::Now(); | 373 g_keyboard_load_time_start.Get() = base::Time::Now(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void MarkKeyboardLoadFinished() { | 376 void MarkKeyboardLoadFinished() { |
| 377 // Possible to get a load finished without a start if navigating directly to | 377 // Possible to get a load finished without a start if navigating directly to |
| 378 // chrome://keyboard. | 378 // chrome://keyboard. |
| 379 if (!g_keyboard_load_time_start.Get().ToInternalValue()) | 379 if (g_keyboard_load_time_start.Get().is_null()) |
| 380 return; | 380 return; |
| 381 | 381 |
| 382 // It should not be possible to finish loading the keyboard without starting | |
| 383 // to load it first. | |
| 384 DCHECK(g_keyboard_load_time_start.Get().ToInternalValue()); | |
| 385 | |
| 386 static bool logged = false; | 382 static bool logged = false; |
| 387 if (!logged) { | 383 if (!logged) { |
| 388 // Log the delta only once. | 384 // Log the delta only once. |
| 389 UMA_HISTOGRAM_TIMES( | 385 UMA_HISTOGRAM_TIMES( |
| 390 "VirtualKeyboard.InitLatency.FirstLoad", | 386 "VirtualKeyboard.InitLatency.FirstLoad", |
| 391 base::Time::Now() - g_keyboard_load_time_start.Get()); | 387 base::Time::Now() - g_keyboard_load_time_start.Get()); |
| 392 logged = true; | 388 logged = true; |
| 393 } | 389 } |
| 394 } | 390 } |
| 395 | 391 |
| 396 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 392 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 397 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event, | 393 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event, |
| 398 KEYBOARD_CONTROL_MAX); | 394 KEYBOARD_CONTROL_MAX); |
| 399 } | 395 } |
| 400 | 396 |
| 401 void SetOverscrollEnabledWithAccessibilityKeyboard(bool enabled) { | 397 void SetOverscrollEnabledWithAccessibilityKeyboard(bool enabled) { |
| 402 g_overscroll_enabled_with_accessibility_keyboard = enabled; | 398 g_overscroll_enabled_with_accessibility_keyboard = enabled; |
| 403 } | 399 } |
| 404 | 400 |
| 405 } // namespace keyboard | 401 } // namespace keyboard |
| OLD | NEW |