OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ | 5 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ |
6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ | 6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "chrome/browser/autocomplete/autocomplete_input.h" | 12 #include "chrome/browser/autocomplete/autocomplete_input.h" |
13 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 13 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
14 #include "chrome/browser/sessions/session_id.h" | 14 #include "chrome/browser/sessions/session_id.h" |
15 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | |
16 | 15 |
17 class AutocompleteResult; | 16 class AutocompleteResult; |
18 | 17 |
19 // The data to log (via the metrics service) when the user selects an item from | 18 // The data to log (via the metrics service) when the user selects an item from |
20 // the omnibox popup. | 19 // the omnibox popup. |
21 struct OmniboxLog { | 20 struct OmniboxLog { |
22 OmniboxLog( | 21 OmniboxLog( |
23 const string16& text, | 22 const string16& text, |
24 bool just_deleted_text, | 23 bool just_deleted_text, |
25 AutocompleteInput::Type input_type, | 24 AutocompleteInput::Type input_type, |
26 size_t selected_index, | 25 size_t selected_index, |
27 SessionID::id_type tab_id, | 26 SessionID::id_type tab_id, |
28 metrics::OmniboxEventProto::PageClassification | 27 AutocompleteInput::PageClassification current_page_classification, |
29 current_page_classification, | |
30 base::TimeDelta elapsed_time_since_user_first_modified_omnibox, | 28 base::TimeDelta elapsed_time_since_user_first_modified_omnibox, |
31 size_t completed_length, | 29 size_t completed_length, |
32 base::TimeDelta elapsed_time_since_last_change_to_default_match, | 30 base::TimeDelta elapsed_time_since_last_change_to_default_match, |
33 const AutocompleteResult& result); | 31 const AutocompleteResult& result); |
34 ~OmniboxLog(); | 32 ~OmniboxLog(); |
35 | 33 |
36 // The user's input text in the omnibox. | 34 // The user's input text in the omnibox. |
37 string16 text; | 35 string16 text; |
38 | 36 |
39 // Whether the user deleted text immediately before selecting an omnibox | 37 // Whether the user deleted text immediately before selecting an omnibox |
40 // suggestion. This is usually the result of pressing backspace or delete. | 38 // suggestion. This is usually the result of pressing backspace or delete. |
41 bool just_deleted_text; | 39 bool just_deleted_text; |
42 | 40 |
43 // The detected type of the user's input. | 41 // The detected type of the user's input. |
44 AutocompleteInput::Type input_type; | 42 AutocompleteInput::Type input_type; |
45 | 43 |
46 // Selected index (if selected) or -1 (OmniboxPopupModel::kNoMatch). | 44 // Selected index (if selected) or -1 (OmniboxPopupModel::kNoMatch). |
47 size_t selected_index; | 45 size_t selected_index; |
48 | 46 |
49 // ID of the tab the selected autocomplete suggestion was opened in. | 47 // ID of the tab the selected autocomplete suggestion was opened in. |
50 // Set to -1 if we haven't yet determined the destination tab. | 48 // Set to -1 if we haven't yet determined the destination tab. |
51 SessionID::id_type tab_id; | 49 SessionID::id_type tab_id; |
52 | 50 |
53 // The type of page (e.g., new tab page, regular web page) that the | 51 // The type of page (e.g., new tab page, regular web page) that the |
54 // user was viewing before going somewhere with the omnibox. | 52 // user was viewing before going somewhere with the omnibox. |
55 metrics::OmniboxEventProto::PageClassification current_page_classification; | 53 AutocompleteInput::PageClassification current_page_classification; |
56 | 54 |
57 // The amount of time since the user first began modifying the text | 55 // The amount of time since the user first began modifying the text |
58 // in the omnibox. If at some point after modifying the text, the | 56 // in the omnibox. If at some point after modifying the text, the |
59 // user reverts the modifications (thus seeing the current web | 57 // user reverts the modifications (thus seeing the current web |
60 // page's URL again), then writes in the omnibox again, this time | 58 // page's URL again), then writes in the omnibox again, this time |
61 // delta should be computed starting from the second series of | 59 // delta should be computed starting from the second series of |
62 // modifications. If we somehow skipped the logic to record | 60 // modifications. If we somehow skipped the logic to record |
63 // the time the user began typing (this should only happen in | 61 // the time the user began typing (this should only happen in |
64 // unit tests), this elapsed time is set to -1 milliseconds. | 62 // unit tests), this elapsed time is set to -1 milliseconds. |
65 base::TimeDelta elapsed_time_since_user_first_modified_omnibox; | 63 base::TimeDelta elapsed_time_since_user_first_modified_omnibox; |
(...skipping 11 matching lines...) Expand all Loading... |
77 // Result set. | 75 // Result set. |
78 const AutocompleteResult& result; | 76 const AutocompleteResult& result; |
79 | 77 |
80 // Diagnostic information from providers. See | 78 // Diagnostic information from providers. See |
81 // AutocompleteController::AddProvidersInfo() and | 79 // AutocompleteController::AddProvidersInfo() and |
82 // AutocompleteProvider::AddProviderInfo() above. | 80 // AutocompleteProvider::AddProviderInfo() above. |
83 ProvidersInfo providers_info; | 81 ProvidersInfo providers_info; |
84 }; | 82 }; |
85 | 83 |
86 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ | 84 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ |
OLD | NEW |