1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_
6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_
10 #include "base/strings/string16.h"
11 #include "base/time/time.h"
12 #include "chrome/browser/autocomplete/autocomplete_input.h"
13 #include "chrome/browser/autocomplete/autocomplete_provider.h"
14 #include "chrome/browser/sessions/session_id.h"
16 class AutocompleteResult
;
18 // The data to log (via the metrics service) when the user selects an item from
22 const base::string16
& text
,
23 bool just_deleted_text
,
24 AutocompleteInput::Type input_type
,
26 size_t selected_index
,
28 SessionID::id_type tab_id
,
29 AutocompleteInput::PageClassification current_page_classification
,
30 base::TimeDelta elapsed_time_since_user_first_modified_omnibox
,
31 size_t completed_length
,
32 base::TimeDelta elapsed_time_since_last_change_to_default_match
,
33 const AutocompleteResult
& result
);
36 // The user's input text in the omnibox.
39 // Whether the user deleted text immediately before selecting an omnibox
40 // suggestion. This is usually the result of pressing backspace or delete.
41 bool just_deleted_text
;
43 // The detected type of the user's input.
44 AutocompleteInput::Type input_type
;
46 // True if the popup is open.
49 // The index of the item selected in the dropdown list. Set to 0 if the
50 // dropdown is closed (and therefore there is only one implicit suggestion).
51 size_t selected_index
;
53 // True if this is a paste-and-search or paste-and-go omnibox interaction.
54 // (The codebase refers to both these types as paste-and-go.)
57 // ID of the tab the selected autocomplete suggestion was opened in.
58 // Set to -1 if we haven't yet determined the destination tab.
59 SessionID::id_type tab_id
;
61 // The type of page (e.g., new tab page, regular web page) that the
62 // user was viewing before going somewhere with the omnibox.
63 AutocompleteInput::PageClassification current_page_classification
;
65 // The amount of time since the user first began modifying the text
66 // in the omnibox. If at some point after modifying the text, the
67 // user reverts the modifications (thus seeing the current web
68 // page's URL again), then writes in the omnibox again, this time
69 // delta should be computed starting from the second series of
70 // modifications. If we somehow skipped the logic to record
71 // the time the user began typing (this should only happen in
72 // unit tests), this elapsed time is set to -1 milliseconds.
73 base::TimeDelta elapsed_time_since_user_first_modified_omnibox
;
75 // The number of extra characters the user would have to manually type
76 // if she/he were not given the opportunity to select this match. Set to
77 // base::string16::npos if not available.
78 size_t completed_length
;
80 // The amount of time since the last time the default (i.e., inline)
81 // match changed. This will certainly be less than
82 // elapsed_time_since_user_first_modified_omnibox. Measuring this
83 // may be inappropriate in some cases (e.g., if editing is not in
84 // progress). In such cases, it's set to -1 milliseconds.
85 base::TimeDelta elapsed_time_since_last_change_to_default_match
;
88 const AutocompleteResult
& result
;
90 // Diagnostic information from providers. See
91 // AutocompleteController::AddProvidersInfo() and
92 // AutocompleteProvider::AddProviderInfo() above.
93 ProvidersInfo providers_info
;
96 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_