diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 19:50:32 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 19:50:32 +0000 |
commit | 19871a981d7996cc1814c0371e0ac0945d24b707 (patch) | |
tree | 8d259f6216cf41e51459dbb4a0c3e766e4f4833e | |
parent | abf10508242ca1c87ba5d4122f741b6216dcf325 (diff) | |
download | chromium_src-19871a981d7996cc1814c0371e0ac0945d24b707.zip chromium_src-19871a981d7996cc1814c0371e0ac0945d24b707.tar.gz chromium_src-19871a981d7996cc1814c0371e0ac0945d24b707.tar.bz2 |
browser: Extract AutocompleteLog from autocomplete.*.
BUG=94842
R=pkasting@chromium.org
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10681008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144526 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 28 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.h | 51 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_log.cc | 31 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_log.h | 79 | ||||
-rw-r--r-- | chrome/browser/history/shortcuts_backend.cc | 2 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 1 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 1 | ||||
-rw-r--r-- | chrome/browser/omnibox_search_hint.cc | 1 | ||||
-rw-r--r-- | chrome/browser/predictors/autocomplete_action_predictor.cc | 1 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/omnibox/omnibox_edit_model.cc | 1 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 |
12 files changed, 119 insertions, 81 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 8649ba1..3a313bb 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -1140,31 +1140,3 @@ void AutocompleteController::StartExpireTimer() { base::TimeDelta::FromMilliseconds(kExpireTimeMS), this, &AutocompleteController::ExpireCopiedEntries); } - -// AutocompleteLog --------------------------------------------------------- - -AutocompleteLog::AutocompleteLog( - const string16& text, - bool just_deleted_text, - AutocompleteInput::Type input_type, - size_t selected_index, - SessionID::id_type tab_id, - metrics::OmniboxEventProto::PageClassification current_page_classification, - base::TimeDelta elapsed_time_since_user_first_modified_omnibox, - size_t inline_autocompleted_length, - const AutocompleteResult& result) - : text(text), - just_deleted_text(just_deleted_text), - input_type(input_type), - selected_index(selected_index), - tab_id(tab_id), - current_page_classification(current_page_classification), - elapsed_time_since_user_first_modified_omnibox( - elapsed_time_since_user_first_modified_omnibox), - inline_autocompleted_length(inline_autocompleted_length), - result(result), - providers_info() { -} - -AutocompleteLog::~AutocompleteLog() { -} diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index 2e76620..e8176e1 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -663,55 +663,4 @@ class AutocompleteController : public AutocompleteProviderListener { DISALLOW_COPY_AND_ASSIGN(AutocompleteController); }; -// AutocompleteLog ------------------------------------------------------------ - -// The data to log (via the metrics service) when the user selects an item -// from the omnibox popup. -struct AutocompleteLog { - AutocompleteLog( - const string16& text, - bool just_deleted_text, - AutocompleteInput::Type input_type, - size_t selected_index, - SessionID::id_type tab_id, - metrics::OmniboxEventProto::PageClassification - current_page_classification, - base::TimeDelta elapsed_time_since_user_first_modified_omnibox, - size_t inline_autocompleted_length, - const AutocompleteResult& result); - ~AutocompleteLog(); - // The user's input text in the omnibox. - string16 text; - // Whether the user deleted text immediately before selecting an omnibox - // suggestion. This is usually the result of pressing backspace or delete. - bool just_deleted_text; - // The detected type of the user's input. - AutocompleteInput::Type input_type; - // Selected index (if selected) or -1 (OmniboxPopupModel::kNoMatch). - size_t selected_index; - // ID of the tab the selected autocomplete suggestion was opened in. - // Set to -1 if we haven't yet determined the destination tab. - SessionID::id_type tab_id; - // The type of page (e.g., new tab page, regular web page) that the - // user was viewing before going somewhere with the omnibox. - metrics::OmniboxEventProto::PageClassification current_page_classification; - // The amount of time since the user first began modifying the text - // in the omnibox. If at some point after modifying the text, the - // user reverts the modifications (thus seeing the current web - // page's URL again), then writes in the omnibox again, this time - // delta should be computed starting from the second series of - // modifications. If we somehow skipped the logic to record - // the time the user began typing (this should only happen in - // unit tests), this elapsed time is set to -1 milliseconds. - base::TimeDelta elapsed_time_since_user_first_modified_omnibox; - // Inline autocompleted length (if displayed). - size_t inline_autocompleted_length; - // Result set. - const AutocompleteResult& result; - // Diagnostic information from providers. See - // AutocompleteController::AddProvidersInfo() and - // AutocompleteProvider::AddProviderInfo() above. - ProvidersInfo providers_info; -}; - #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ diff --git a/chrome/browser/autocomplete/autocomplete_log.cc b/chrome/browser/autocomplete/autocomplete_log.cc new file mode 100644 index 0000000..77023c0 --- /dev/null +++ b/chrome/browser/autocomplete/autocomplete_log.cc @@ -0,0 +1,31 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autocomplete/autocomplete_log.h" + +AutocompleteLog::AutocompleteLog( + const string16& text, + bool just_deleted_text, + AutocompleteInput::Type input_type, + size_t selected_index, + SessionID::id_type tab_id, + metrics::OmniboxEventProto::PageClassification current_page_classification, + base::TimeDelta elapsed_time_since_user_first_modified_omnibox, + size_t inline_autocompleted_length, + const AutocompleteResult& result) + : text(text), + just_deleted_text(just_deleted_text), + input_type(input_type), + selected_index(selected_index), + tab_id(tab_id), + current_page_classification(current_page_classification), + elapsed_time_since_user_first_modified_omnibox( + elapsed_time_since_user_first_modified_omnibox), + inline_autocompleted_length(inline_autocompleted_length), + result(result), + providers_info() { +} + +AutocompleteLog::~AutocompleteLog() { +} diff --git a/chrome/browser/autocomplete/autocomplete_log.h b/chrome/browser/autocomplete/autocomplete_log.h new file mode 100644 index 0000000..17f25d9 --- /dev/null +++ b/chrome/browser/autocomplete/autocomplete_log.h @@ -0,0 +1,79 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_LOG_H_ +#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_LOG_H_ +#pragma once + +#include <stddef.h> + +#include "base/string16.h" +#include "base/time.h" +#include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_types.h" +#include "chrome/browser/sessions/session_id.h" +#include "chrome/common/metrics/proto/omnibox_event.pb.h" + +class AutocompleteResult; + +// The data to log (via the metrics service) when the user selects an item from +// the omnibox popup. +struct AutocompleteLog { + AutocompleteLog( + const string16& text, + bool just_deleted_text, + AutocompleteInput::Type input_type, + size_t selected_index, + SessionID::id_type tab_id, + metrics::OmniboxEventProto::PageClassification + current_page_classification, + base::TimeDelta elapsed_time_since_user_first_modified_omnibox, + size_t inline_autocompleted_length, + const AutocompleteResult& result); + ~AutocompleteLog(); + + // The user's input text in the omnibox. + string16 text; + + // Whether the user deleted text immediately before selecting an omnibox + // suggestion. This is usually the result of pressing backspace or delete. + bool just_deleted_text; + + // The detected type of the user's input. + AutocompleteInput::Type input_type; + + // Selected index (if selected) or -1 (OmniboxPopupModel::kNoMatch). + size_t selected_index; + + // ID of the tab the selected autocomplete suggestion was opened in. + // Set to -1 if we haven't yet determined the destination tab. + SessionID::id_type tab_id; + + // The type of page (e.g., new tab page, regular web page) that the + // user was viewing before going somewhere with the omnibox. + metrics::OmniboxEventProto::PageClassification current_page_classification; + + // The amount of time since the user first began modifying the text + // in the omnibox. If at some point after modifying the text, the + // user reverts the modifications (thus seeing the current web + // page's URL again), then writes in the omnibox again, this time + // delta should be computed starting from the second series of + // modifications. If we somehow skipped the logic to record + // the time the user began typing (this should only happen in + // unit tests), this elapsed time is set to -1 milliseconds. + base::TimeDelta elapsed_time_since_user_first_modified_omnibox; + + // Inline autocompleted length (if displayed). + size_t inline_autocompleted_length; + + // Result set. + const AutocompleteResult& result; + + // Diagnostic information from providers. See + // AutocompleteController::AddProvidersInfo() and + // AutocompleteProvider::AddProviderInfo() above. + ProvidersInfo providers_info; +}; + +#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_LOG_H_ diff --git a/chrome/browser/history/shortcuts_backend.cc b/chrome/browser/history/shortcuts_backend.cc index f230579..42d7929 100644 --- a/chrome/browser/history/shortcuts_backend.cc +++ b/chrome/browser/history/shortcuts_backend.cc @@ -13,7 +13,7 @@ #include "base/guid.h" #include "base/i18n/case_conversion.h" #include "base/string_util.h" -#include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_notifications.h" diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index e68f7dc..1469674 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -21,6 +21,7 @@ #include "base/tracked_objects.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_provider.h" #include "chrome/browser/browser_process.h" diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 8ad9f4c..28110af 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -160,6 +160,7 @@ #include "base/tracked_objects.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_service.h" diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index a0a834d..8f5b0fe 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -10,6 +10,7 @@ #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/prefs/pref_service.h" diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index 9330445..c5ce8a1 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -16,6 +16,7 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_notifications.h" diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc index cc19aa1..03839c1 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -9,7 +9,7 @@ #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autocomplete/autocomplete.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/google/google_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc index d4b3f60..9c0ddd5 100644 --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc @@ -13,6 +13,7 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" +#include "chrome/browser/autocomplete/autocomplete_log.h" #include "chrome/browser/autocomplete/extension_app_provider.h" #include "chrome/browser/autocomplete/keyword_provider.h" #include "chrome/browser/autocomplete/search_provider.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index b4b6cee..c3c157a 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -121,6 +121,8 @@ 'browser/autocomplete/autocomplete_controller_delegate.h', 'browser/autocomplete/autocomplete_field_trial.cc', 'browser/autocomplete/autocomplete_field_trial.h', + 'browser/autocomplete/autocomplete_log.cc', + 'browser/autocomplete/autocomplete_log.h', 'browser/autocomplete/autocomplete_match.cc', 'browser/autocomplete/autocomplete_match.h', 'browser/autocomplete/autocomplete_provider.cc', |