OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return OmniboxEventProto::Suggestion::CONTACT; | 135 return OmniboxEventProto::Suggestion::CONTACT; |
136 case AutocompleteMatchType::BOOKMARK_TITLE: | 136 case AutocompleteMatchType::BOOKMARK_TITLE: |
137 return OmniboxEventProto::Suggestion::BOOKMARK_TITLE; | 137 return OmniboxEventProto::Suggestion::BOOKMARK_TITLE; |
138 default: | 138 default: |
139 NOTREACHED(); | 139 NOTREACHED(); |
140 return OmniboxEventProto::Suggestion::UNKNOWN_RESULT_TYPE; | 140 return OmniboxEventProto::Suggestion::UNKNOWN_RESULT_TYPE; |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 OmniboxEventProto::PageClassification AsOmniboxEventPageClassification( | 144 OmniboxEventProto::PageClassification AsOmniboxEventPageClassification( |
145 AutocompleteInput::PageClassification page_classification) { | 145 AutocompleteInput::OmniboxContext omnibox_context) { |
146 switch (page_classification) { | 146 switch (omnibox_context) { |
147 case AutocompleteInput::INVALID_SPEC: | 147 case AutocompleteInput::INVALID_SPEC: |
148 return OmniboxEventProto::INVALID_SPEC; | 148 return OmniboxEventProto::INVALID_SPEC; |
149 case AutocompleteInput::NEW_TAB_PAGE: | 149 case AutocompleteInput::NEW_TAB_PAGE: |
150 return OmniboxEventProto::NEW_TAB_PAGE; | 150 return OmniboxEventProto::NEW_TAB_PAGE; |
151 case AutocompleteInput::BLANK: | 151 case AutocompleteInput::BLANK: |
152 return OmniboxEventProto::BLANK; | 152 return OmniboxEventProto::BLANK; |
153 case AutocompleteInput::HOMEPAGE: | 153 case AutocompleteInput::HOMEPAGE: |
154 return OmniboxEventProto::HOMEPAGE; | 154 return OmniboxEventProto::HOMEPAGE; |
155 case AutocompleteInput::OTHER: | 155 case AutocompleteInput::OTHER: |
156 return OmniboxEventProto::OTHER; | 156 return OmniboxEventProto::OTHER; |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 omnibox_event->set_completed_length(log.completed_length); | 848 omnibox_event->set_completed_length(log.completed_length); |
849 if (log.elapsed_time_since_user_first_modified_omnibox != | 849 if (log.elapsed_time_since_user_first_modified_omnibox != |
850 base::TimeDelta::FromMilliseconds(-1)) { | 850 base::TimeDelta::FromMilliseconds(-1)) { |
851 // Only upload the typing duration if it is set/valid. | 851 // Only upload the typing duration if it is set/valid. |
852 omnibox_event->set_typing_duration_ms( | 852 omnibox_event->set_typing_duration_ms( |
853 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); | 853 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); |
854 } | 854 } |
855 omnibox_event->set_duration_since_last_default_match_update_ms( | 855 omnibox_event->set_duration_since_last_default_match_update_ms( |
856 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); | 856 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); |
857 omnibox_event->set_current_page_classification( | 857 omnibox_event->set_current_page_classification( |
858 AsOmniboxEventPageClassification(log.current_page_classification)); | 858 AsOmniboxEventPageClassification(log.omnibox_context)); |
859 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); | 859 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); |
860 | 860 |
861 // The view code to hide the top result is currently only implemented on the | 861 // The view code to hide the top result is currently only implemented on the |
862 // Mac. | 862 // Mac. |
863 #if defined(OS_MACOSX) | 863 #if defined(OS_MACOSX) |
864 omnibox_event->set_is_top_result_hidden_in_dropdown( | 864 omnibox_event->set_is_top_result_hidden_in_dropdown( |
865 log.result.ShouldHideTopMatch()); | 865 log.result.ShouldHideTopMatch()); |
866 #endif // defined(OS_MACOSX) | 866 #endif // defined(OS_MACOSX) |
867 | 867 |
868 for (AutocompleteResult::const_iterator i(log.result.begin()); | 868 for (AutocompleteResult::const_iterator i(log.result.begin()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 | 952 |
953 paired_device->set_vendor_prefix(vendor_prefix); | 953 paired_device->set_vendor_prefix(vendor_prefix); |
954 } | 954 } |
955 | 955 |
956 paired_device->set_vendor_id(device->GetVendorID()); | 956 paired_device->set_vendor_id(device->GetVendorID()); |
957 paired_device->set_product_id(device->GetProductID()); | 957 paired_device->set_product_id(device->GetProductID()); |
958 paired_device->set_device_id(device->GetDeviceID()); | 958 paired_device->set_device_id(device->GetDeviceID()); |
959 } | 959 } |
960 #endif // defined(OS_CHROMEOS) | 960 #endif // defined(OS_CHROMEOS) |
961 } | 961 } |
OLD | NEW |