| 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 } |
| 163 return OmniboxEventProto::INVALID_SPEC; |
| 164 } |
| 165 |
| 144 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( | 166 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( |
| 145 int process_type) { | 167 int process_type) { |
| 146 switch (process_type) { | 168 switch (process_type) { |
| 147 case content::PROCESS_TYPE_BROWSER: | 169 case content::PROCESS_TYPE_BROWSER: |
| 148 return ProfilerEventProto::TrackedObject::BROWSER; | 170 return ProfilerEventProto::TrackedObject::BROWSER; |
| 149 case content::PROCESS_TYPE_RENDERER: | 171 case content::PROCESS_TYPE_RENDERER: |
| 150 return ProfilerEventProto::TrackedObject::RENDERER; | 172 return ProfilerEventProto::TrackedObject::RENDERER; |
| 151 case content::PROCESS_TYPE_PLUGIN: | 173 case content::PROCESS_TYPE_PLUGIN: |
| 152 return ProfilerEventProto::TrackedObject::PLUGIN; | 174 return ProfilerEventProto::TrackedObject::PLUGIN; |
| 153 case content::PROCESS_TYPE_WORKER: | 175 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); | 844 omnibox_event->set_completed_length(log.completed_length); |
| 823 if (log.elapsed_time_since_user_first_modified_omnibox != | 845 if (log.elapsed_time_since_user_first_modified_omnibox != |
| 824 base::TimeDelta::FromMilliseconds(-1)) { | 846 base::TimeDelta::FromMilliseconds(-1)) { |
| 825 // Only upload the typing duration if it is set/valid. | 847 // Only upload the typing duration if it is set/valid. |
| 826 omnibox_event->set_typing_duration_ms( | 848 omnibox_event->set_typing_duration_ms( |
| 827 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); | 849 log.elapsed_time_since_user_first_modified_omnibox.InMilliseconds()); |
| 828 } | 850 } |
| 829 omnibox_event->set_duration_since_last_default_match_update_ms( | 851 omnibox_event->set_duration_since_last_default_match_update_ms( |
| 830 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); | 852 log.elapsed_time_since_last_change_to_default_match.InMilliseconds()); |
| 831 omnibox_event->set_current_page_classification( | 853 omnibox_event->set_current_page_classification( |
| 832 log.current_page_classification); | 854 AsOmniboxEventPageClassification(log.current_page_classification)); |
| 833 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); | 855 omnibox_event->set_input_type(AsOmniboxEventInputType(log.input_type)); |
| 834 for (AutocompleteResult::const_iterator i(log.result.begin()); | 856 for (AutocompleteResult::const_iterator i(log.result.begin()); |
| 835 i != log.result.end(); ++i) { | 857 i != log.result.end(); ++i) { |
| 836 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion(); | 858 OmniboxEventProto::Suggestion* suggestion = omnibox_event->add_suggestion(); |
| 837 suggestion->set_provider(i->provider->AsOmniboxEventProviderType()); | 859 suggestion->set_provider(i->provider->AsOmniboxEventProviderType()); |
| 838 suggestion->set_result_type(AsOmniboxEventResultType(i->type)); | 860 suggestion->set_result_type(AsOmniboxEventResultType(i->type)); |
| 839 suggestion->set_relevance(i->relevance); | 861 suggestion->set_relevance(i->relevance); |
| 840 if (i->typed_count != -1) | 862 if (i->typed_count != -1) |
| 841 suggestion->set_typed_count(i->typed_count); | 863 suggestion->set_typed_count(i->typed_count); |
| 842 suggestion->set_is_starred(i->starred); | 864 suggestion->set_is_starred(i->starred); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 | 940 |
| 919 paired_device->set_vendor_prefix(vendor_prefix); | 941 paired_device->set_vendor_prefix(vendor_prefix); |
| 920 } | 942 } |
| 921 | 943 |
| 922 paired_device->set_vendor_id(device->GetVendorID()); | 944 paired_device->set_vendor_id(device->GetVendorID()); |
| 923 paired_device->set_product_id(device->GetProductID()); | 945 paired_device->set_product_id(device->GetProductID()); |
| 924 paired_device->set_device_id(device->GetDeviceID()); | 946 paired_device->set_device_id(device->GetDeviceID()); |
| 925 } | 947 } |
| 926 #endif // defined(OS_CHROMEOS) | 948 #endif // defined(OS_CHROMEOS) |
| 927 } | 949 } |
| OLD | NEW |