| 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" | |
| 13 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 12 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 14 #include "chrome/browser/sessions/session_id.h" | 13 #include "chrome/browser/sessions/session_id.h" |
| 14 #include "components/metrics/proto/omnibox_event.pb.h" |
| 15 #include "components/metrics/proto/omnibox_input_type.pb.h" | 15 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 16 | 16 |
| 17 class AutocompleteResult; | 17 class AutocompleteResult; |
| 18 | 18 |
| 19 // The data to log (via the metrics service) when the user selects an item from | 19 // The data to log (via the metrics service) when the user selects an item from |
| 20 // the omnibox popup. | 20 // the omnibox popup. |
| 21 struct OmniboxLog { | 21 struct OmniboxLog { |
| 22 OmniboxLog( | 22 OmniboxLog( |
| 23 const base::string16& text, | 23 const base::string16& text, |
| 24 bool just_deleted_text, | 24 bool just_deleted_text, |
| 25 metrics::OmniboxInputType::Type input_type, | 25 metrics::OmniboxInputType::Type input_type, |
| 26 bool is_popup_open, | 26 bool is_popup_open, |
| 27 size_t selected_index, | 27 size_t selected_index, |
| 28 bool is_paste_and_go, | 28 bool is_paste_and_go, |
| 29 SessionID::id_type tab_id, | 29 SessionID::id_type tab_id, |
| 30 AutocompleteInput::PageClassification current_page_classification, | 30 metrics::OmniboxEventProto::PageClassification |
| 31 current_page_classification, |
| 31 base::TimeDelta elapsed_time_since_user_first_modified_omnibox, | 32 base::TimeDelta elapsed_time_since_user_first_modified_omnibox, |
| 32 size_t completed_length, | 33 size_t completed_length, |
| 33 base::TimeDelta elapsed_time_since_last_change_to_default_match, | 34 base::TimeDelta elapsed_time_since_last_change_to_default_match, |
| 34 const AutocompleteResult& result); | 35 const AutocompleteResult& result); |
| 35 ~OmniboxLog(); | 36 ~OmniboxLog(); |
| 36 | 37 |
| 37 // The user's input text in the omnibox. | 38 // The user's input text in the omnibox. |
| 38 base::string16 text; | 39 base::string16 text; |
| 39 | 40 |
| 40 // Whether the user deleted text immediately before selecting an omnibox | 41 // Whether the user deleted text immediately before selecting an omnibox |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 // True if this is a paste-and-search or paste-and-go omnibox interaction. | 55 // True if this is a paste-and-search or paste-and-go omnibox interaction. |
| 55 // (The codebase refers to both these types as paste-and-go.) | 56 // (The codebase refers to both these types as paste-and-go.) |
| 56 bool is_paste_and_go; | 57 bool is_paste_and_go; |
| 57 | 58 |
| 58 // ID of the tab the selected autocomplete suggestion was opened in. | 59 // ID of the tab the selected autocomplete suggestion was opened in. |
| 59 // Set to -1 if we haven't yet determined the destination tab. | 60 // Set to -1 if we haven't yet determined the destination tab. |
| 60 SessionID::id_type tab_id; | 61 SessionID::id_type tab_id; |
| 61 | 62 |
| 62 // The type of page (e.g., new tab page, regular web page) that the | 63 // The type of page (e.g., new tab page, regular web page) that the |
| 63 // user was viewing before going somewhere with the omnibox. | 64 // user was viewing before going somewhere with the omnibox. |
| 64 AutocompleteInput::PageClassification current_page_classification; | 65 metrics::OmniboxEventProto::PageClassification current_page_classification; |
| 65 | 66 |
| 66 // The amount of time since the user first began modifying the text | 67 // The amount of time since the user first began modifying the text |
| 67 // in the omnibox. If at some point after modifying the text, the | 68 // in the omnibox. If at some point after modifying the text, the |
| 68 // user reverts the modifications (thus seeing the current web | 69 // user reverts the modifications (thus seeing the current web |
| 69 // page's URL again), then writes in the omnibox again, this time | 70 // page's URL again), then writes in the omnibox again, this time |
| 70 // delta should be computed starting from the second series of | 71 // delta should be computed starting from the second series of |
| 71 // modifications. If we somehow skipped the logic to record | 72 // modifications. If we somehow skipped the logic to record |
| 72 // the time the user began typing (this should only happen in | 73 // the time the user began typing (this should only happen in |
| 73 // unit tests), this elapsed time is set to -1 milliseconds. | 74 // unit tests), this elapsed time is set to -1 milliseconds. |
| 74 base::TimeDelta elapsed_time_since_user_first_modified_omnibox; | 75 base::TimeDelta elapsed_time_since_user_first_modified_omnibox; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 // Result set. | 91 // Result set. |
| 91 const AutocompleteResult& result; | 92 const AutocompleteResult& result; |
| 92 | 93 |
| 93 // Diagnostic information from providers. See | 94 // Diagnostic information from providers. See |
| 94 // AutocompleteController::AddProvidersInfo() and | 95 // AutocompleteController::AddProvidersInfo() and |
| 95 // AutocompleteProvider::AddProviderInfo() above. | 96 // AutocompleteProvider::AddProviderInfo() above. |
| 96 ProvidersInfo providers_info; | 97 ProvidersInfo providers_info; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ | 100 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_LOG_H_ |
| OLD | NEW |