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

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

Issue 21452002: Add metric Omnibox.FocusToOpenTime for time from omnibox focus to omnibox usage. (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 214454)
+++ chrome/browser/ui/omnibox/omnibox_edit_model.cc (working copy)
@@ -97,6 +97,10 @@
// between focusing and editing the omnibox.
const char kFocusToEditTimeHistogram[] = "Omnibox.FocusToEditTime";
+// Histogram name which counts the number of milliseconds a user takes
+// between focusing and opening an omnibox match.
+const char kFocusToOpenTimeHistogram[] = "Omnibox.FocusToOpenTime";
+
void RecordPercentageMatchHistogram(const string16& old_text,
const string16& new_text,
bool search_term_replacement_active,
@@ -164,6 +168,7 @@
controller_(controller),
focus_state_(OMNIBOX_FOCUS_NONE),
user_input_in_progress_(false),
+ user_input_since_focus_(true),
just_deleted_text_(false),
has_temporary_text_(false),
paste_state_(NONE),
@@ -414,14 +419,11 @@
}
void OmniboxEditModel::SetInputInProgress(bool in_progress) {
- if (in_progress && !last_omnibox_focus_without_user_input_.is_null()) {
+ if (in_progress && !user_input_since_focus_) {
base::TimeTicks now = base::TimeTicks::Now();
- DCHECK(last_omnibox_focus_without_user_input_ <= now);
- UMA_HISTOGRAM_TIMES(kFocusToEditTimeHistogram,
- 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_| to null.
- last_omnibox_focus_without_user_input_ = base::TimeTicks();
+ DCHECK(last_omnibox_focus_ <= now);
Peter Kasting 2013/08/01 18:19:44 Nit: Does DCHECK_LE compile?
H Fung 2013/08/01 18:36:00 It doesn't. I think it's because operator<<(ostre
+ UMA_HISTOGRAM_TIMES(kFocusToEditTimeHistogram, now - last_omnibox_focus_);
+ user_input_since_focus_ = true;
}
if (user_input_in_progress_ == in_progress)
@@ -643,6 +645,8 @@
<< "omnibox text at same time or before the most recent time the "
<< "default match changed.";
+ UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_);
+
if (index != OmniboxPopupModel::kNoMatch)
log.selected_index = index;
@@ -794,7 +798,8 @@
}
void OmniboxEditModel::OnSetFocus(bool control_down) {
- last_omnibox_focus_without_user_input_ = base::TimeTicks::Now();
+ last_omnibox_focus_ = base::TimeTicks::Now();
+ user_input_since_focus_ = false;
// If the omnibox lost focus while the caret was hidden and then regained
// focus, OnSetFocus() is called and should restore visibility. Note that

Powered by Google App Engine
This is Rietveld 408576698