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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 18866003: Add histogram Omnibox.FocusToEditTime for time in milliseconds between a user focus and edit. (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc
===================================================================
--- chrome/browser/ui/omnibox/omnibox_edit_model.cc (revision 209999)
+++ chrome/browser/ui/omnibox/omnibox_edit_model.cc (working copy)
@@ -93,6 +93,10 @@
// in the EnteredKeywordModeMethod enum which is defined in the .h file.
const char kEnteredKeywordModeHistogram[] = "Omnibox.EnteredKeywordMode";
+// Histogram name which counts the number of milliseconds a user takes
+// between focusing and editing the omnibox.
+const char kFocusToEditHistogram[] = "Omnibox.FocusToEdit";
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -407,6 +411,16 @@
}
void OmniboxEditModel::SetInputInProgress(bool in_progress) {
+ if (in_progress && !last_omnibox_focus_without_user_input_.is_null()) {
+ base::TimeTicks now = base::TimeTicks::Now();
+ DCHECK(last_omnibox_focus_without_user_input_ <= now);
Peter Kasting 2013/07/09 00:43:21 Nit: DCHECK_LE However, I don't think this is gua
H Fung 2013/07/09 01:09:55 Actually, it looks like TimeTicks is guaranteed to
Peter Kasting 2013/07/09 01:21:46 Oh good. I must have been thinking of Time::Now()
+ UMA_HISTOGRAM_TIMES(kFocusToEditHistogram,
+ now - last_omnibox_focus_without_user_input_);
+ // We only want to count the time from focus to the first user input, so
+ // reset |last_omnibox_focus_without_user_input_|.
+ last_omnibox_focus_without_user_input_ = base::TimeTicks();
+ }
+
if (user_input_in_progress_ == in_progress)
return;
@@ -802,6 +816,8 @@
}
void OmniboxEditModel::OnSetFocus(bool control_down) {
+ last_omnibox_focus_without_user_input_ = base::TimeTicks::Now();
+
// If the omnibox lost focus while the caret was hidden and then regained
// focus, OnSetFocus() is called and should restore visibility. Note that
// focus can be regained without an accompanying call to

Powered by Google App Engine
This is Rietveld 408576698