summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 09:42:39 +0000
committerbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 09:42:39 +0000
commit9d58e3df5db2c3de7110214093fe2b2fe21fb9d4 (patch)
tree72104afffbfbdb2db45ecad6c70fe5691704df3b
parent0a0ddd354dbcbcc5df4e39cb13d502a6c529903c (diff)
downloadchromium_src-9d58e3df5db2c3de7110214093fe2b2fe21fb9d4.zip
chromium_src-9d58e3df5db2c3de7110214093fe2b2fe21fb9d4.tar.gz
chromium_src-9d58e3df5db2c3de7110214093fe2b2fe21fb9d4.tar.bz2
Do not set completed_length to 0 if not available.
BUG=159493 TBR=isherman@chromium.org Review URL: https://chromiumcodereview.appspot.com/11365118 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167343 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_log.h3
-rw-r--r--chrome/browser/metrics/metrics_log.cc6
-rw-r--r--chrome/browser/ui/omnibox/omnibox_edit_model.cc2
-rw-r--r--chrome/common/metrics/proto/omnibox_event.proto2
4 files changed, 9 insertions, 4 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_log.h b/chrome/browser/autocomplete/autocomplete_log.h
index 4dec692..245481b 100644
--- a/chrome/browser/autocomplete/autocomplete_log.h
+++ b/chrome/browser/autocomplete/autocomplete_log.h
@@ -63,7 +63,8 @@ struct AutocompleteLog {
// unit tests), this elapsed time is set to -1 milliseconds.
base::TimeDelta elapsed_time_since_user_first_modified_omnibox;
- // Inline autocompleted length (if displayed).
+ // Inline autocompleted length (if displayed). Set to string16::npos
+ // if not available.
size_t inline_autocompleted_length;
// Result set.
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index a664db0..9ff3957 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -933,7 +933,8 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) {
WriteIntAttribute("numterms", num_terms);
WriteIntAttribute("selectedindex", static_cast<int>(log.selected_index));
WriteIntAttribute("completedlength",
- static_cast<int>(log.inline_autocompleted_length));
+ log.inline_autocompleted_length != string16::npos ?
+ static_cast<int>(log.inline_autocompleted_length) : 0);
if (log.elapsed_time_since_user_first_modified_omnibox !=
base::TimeDelta::FromMilliseconds(-1)) {
// Only upload the typing duration if it is set/valid.
@@ -969,7 +970,8 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) {
omnibox_event->set_just_deleted_text(log.just_deleted_text);
omnibox_event->set_num_typed_terms(num_terms);
omnibox_event->set_selected_index(log.selected_index);
- omnibox_event->set_completed_length(log.inline_autocompleted_length);
+ if (log.inline_autocompleted_length != string16::npos)
+ omnibox_event->set_completed_length(log.inline_autocompleted_length);
if (log.elapsed_time_since_user_first_modified_omnibox !=
base::TimeDelta::FromMilliseconds(-1)) {
// Only upload the typing duration if it is set/valid.
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
index aaea2c9..cabe939 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -550,7 +550,7 @@ void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
ClassifyPage(controller_->GetTabContents()->
web_contents()->GetURL()),
base::TimeTicks::Now() - time_user_first_modified_omnibox_,
- 0, // inline autocomplete length; possibly set later
+ string16::npos, // inline autocomplete length; possibly set later
result());
DCHECK(user_input_in_progress_ ||
match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST)
diff --git a/chrome/common/metrics/proto/omnibox_event.proto b/chrome/common/metrics/proto/omnibox_event.proto
index f377800..dc1b77a 100644
--- a/chrome/common/metrics/proto/omnibox_event.proto
+++ b/chrome/common/metrics/proto/omnibox_event.proto
@@ -38,6 +38,8 @@ message OmniboxEventProto {
// The length of the inline autocomplete text in the omnibox.
// The sum |typed_length| + |completed_length| gives the full length of the
// user-visible text in the omnibox.
+ // This field is only set for inlineable suggestions selected at position 0
+ // (|selected_index| = 0) and will be omitted otherwise.
optional int32 completed_length = 6;
// The amount of time, in milliseconds, since the user first began modifying