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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 case AutocompleteMatchType::CONTACT: | 134 case AutocompleteMatchType::CONTACT: |
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( | |
145 AutocompleteInput::PageClassification page_classification) { | |
146 switch (page_classification) { | |
147 case AutocompleteInput::INVALID_SPEC: | |
148 return OmniboxEventProto::INVALID_SPEC; | |
149 case AutocompleteInput::NEW_TAB_PAGE: | |
150 return OmniboxEventProto::NEW_TAB_PAGE; | |
151 case AutocompleteInput::BLANK: | |
152 return OmniboxEventProto::BLANK; | |
153 case AutocompleteInput::HOMEPAGE: | |
154 return OmniboxEventProto::HOMEPAGE; | |
155 case AutocompleteInput::OTHER: | |
156 return OmniboxEventProto::OTHER; | |
157 case AutocompleteInput::INSTANT_NEW_TAB_PAGE: | |
158 return OmniboxEventProto::INSTANT_NEW_TAB_PAGE; | |
159 case AutocompleteInput::SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT: | |
160 return OmniboxEventProto:: | |
161 SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT; | |
162 default: | |
Ilya Sherman
2013/07/26 21:40:56
nit: Please remove the default case, so that it's
Mark P
2013/07/26 21:55:27
Done.
| |
163 NOTREACHED(); | |
164 return OmniboxEventProto::INVALID_SPEC; | |
165 } | |
166 } | |
167 | |
144 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( | 168 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( |
145 int process_type) { | 169 int process_type) { |
146 switch (process_type) { | 170 switch (process_type) { |
147 case content::PROCESS_TYPE_BROWSER: | 171 case content::PROCESS_TYPE_BROWSER: |
148 return ProfilerEventProto::TrackedObject::BROWSER; | 172 return ProfilerEventProto::TrackedObject::BROWSER; |
149 case content::PROCESS_TYPE_RENDERER: | 173 case content::PROCESS_TYPE_RENDERER: |
150 return ProfilerEventProto::TrackedObject::RENDERER; | 174 return ProfilerEventProto::TrackedObject::RENDERER; |
151 case content::PROCESS_TYPE_PLUGIN: | 175 case content::PROCESS_TYPE_PLUGIN: |
152 return ProfilerEventProto::TrackedObject::PLUGIN; | 176 return ProfilerEventProto::TrackedObject::PLUGIN; |
153 case content::PROCESS_TYPE_WORKER: | 177 case content::PROCESS_TYPE_WORKER: |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 omnibox_event->set_completed_length(log.completed_length); | 846 omnibox_event->set_completed_length(log.completed_length); |
823 if (log.elapsed_time_since_user_first_modified_omnibox != | 847 if (log.elapsed_time_since_user_first_modified_omnibox != |
824 base::TimeDelta::FromMilliseconds(-1)) { | 848 base::TimeDelta::FromMilliseconds(-1)) { |
825 // Only upload the typing duration if it is set/valid. | 849 // Only upload the typing duration if it is set/valid. |
826 omnibox_event->set_typing_duration_ms( | 850 omnibox_event->set_typing_duration_ms( |
827 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); | 851 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); |
828 } | 852 } |
829 omnibox_event->set_duration_since_last_default_match_update_ms( | 853 omnibox_event->set_duration_since_last_default_match_update_ms( |
830 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); | 854 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); |
831 omnibox_event->set_current_page_classification( | 855 omnibox_event->set_current_page_classification( |
832 log.current_page_classification); | 856 AsOmniboxEventPageClassification(log.current_page_classification)); |
833 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); | 857 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); |
834 for (AutocompleteResult::const_iterator i(log.result.begin()); | 858 for (AutocompleteResult::const_iterator i(log.result.begin()); |
835 i != log.result.end(); ++i) { | 859 i != log.result.end(); ++i) { |
836 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion(); | 860 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion(); |
837 suggestion->set_provider(i->provider->AsOmniboxEventProviderType()); | 861 suggestion->set_provider(i->provider->AsOmniboxEventProviderType()); |
838 suggestion->set_result_type(AsOmniboxEventResultType(i->type)); | 862 suggestion->set_result_type(AsOmniboxEventResultType(i->type)); |
839 suggestion->set_relevance(i->relevance); | 863 suggestion->set_relevance(i->relevance); |
840 if (i->typed_count != -1) | 864 if (i->typed_count != -1) |
841 suggestion->set_typed_count(i->typed_count); | 865 suggestion->set_typed_count(i->typed_count); |
842 suggestion->set_is_starred(i->starred); | 866 suggestion->set_is_starred(i->starred); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 | 942 |
919 paired_device->set_vendor_prefix(vendor_prefix); | 943 paired_device->set_vendor_prefix(vendor_prefix); |
920 } | 944 } |
921 | 945 |
922 paired_device->set_vendor_id(device->GetVendorID()); | 946 paired_device->set_vendor_id(device->GetVendorID()); |
923 paired_device->set_product_id(device->GetProductID()); | 947 paired_device->set_product_id(device->GetProductID()); |
924 paired_device->set_device_id(device->GetDeviceID()); | 948 paired_device->set_device_id(device->GetDeviceID()); |
925 } | 949 } |
926 #endif // defined(OS_CHROMEOS) | 950 #endif // defined(OS_CHROMEOS) |
927 } | 951 } |
OLD | NEW |