| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 const void MarkKeyboardLoadStarted() { | 163 const void MarkKeyboardLoadStarted() { |
| 164 if (!g_keyboard_load_time_start.Get().ToInternalValue()) | 164 if (!g_keyboard_load_time_start.Get().ToInternalValue()) |
| 165 g_keyboard_load_time_start.Get() = base::Time::Now(); | 165 g_keyboard_load_time_start.Get() = base::Time::Now(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 const void MarkKeyboardLoadFinished() { | 168 const void MarkKeyboardLoadFinished() { |
| 169 // Possible to get a load finished without a start if navigating directly to |
| 170 // chrome://keyboard. |
| 171 if (!g_keyboard_load_time_start.Get().ToInternalValue()) |
| 172 return; |
| 173 |
| 169 // It should not be possible to finish loading the keyboard without starting | 174 // It should not be possible to finish loading the keyboard without starting |
| 170 // to load it first. | 175 // to load it first. |
| 171 DCHECK(g_keyboard_load_time_start.Get().ToInternalValue()); | 176 DCHECK(g_keyboard_load_time_start.Get().ToInternalValue()); |
| 172 | 177 |
| 173 static bool logged = false; | 178 static bool logged = false; |
| 174 if (!logged) { | 179 if (!logged) { |
| 175 // Log the delta only once. | 180 // Log the delta only once. |
| 176 UMA_HISTOGRAM_TIMES( | 181 UMA_HISTOGRAM_TIMES( |
| 177 "VirtualKeyboard.FirstLoadTime", | 182 "VirtualKeyboard.FirstLoadTime", |
| 178 base::Time::Now() - g_keyboard_load_time_start.Get()); | 183 base::Time::Now() - g_keyboard_load_time_start.Get()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 256 } |
| 252 | 257 |
| 253 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 258 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 254 UMA_HISTOGRAM_ENUMERATION( | 259 UMA_HISTOGRAM_ENUMERATION( |
| 255 "VirtualKeyboard.KeyboardControlEvent", | 260 "VirtualKeyboard.KeyboardControlEvent", |
| 256 event, | 261 event, |
| 257 keyboard::KEYBOARD_CONTROL_MAX); | 262 keyboard::KEYBOARD_CONTROL_MAX); |
| 258 } | 263 } |
| 259 | 264 |
| 260 } // namespace keyboard | 265 } // namespace keyboard |
| OLD | NEW |