| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/ntp_snippets/content_suggestions_metrics.h" | 5 #include "components/ntp_snippets/content_suggestions_metrics.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 UMA_HISTOGRAM_ENUMERATION(kHistogramOpened, global_position, | 174 UMA_HISTOGRAM_ENUMERATION(kHistogramOpened, global_position, |
| 175 kMaxSuggestionsTotal); | 175 kMaxSuggestionsTotal); |
| 176 LogCategoryHistogramEnumeration(kHistogramOpened, category, category_position, | 176 LogCategoryHistogramEnumeration(kHistogramOpened, category, category_position, |
| 177 kMaxSuggestionsPerCategory); | 177 kMaxSuggestionsPerCategory); |
| 178 | 178 |
| 179 base::TimeDelta age = base::Time::Now() - publish_date; | 179 base::TimeDelta age = base::Time::Now() - publish_date; |
| 180 LogCategoryHistogramAge(kHistogramOpenedAge, category, age); | 180 LogCategoryHistogramAge(kHistogramOpenedAge, category, age); |
| 181 | 181 |
| 182 LogCategoryHistogramScore(kHistogramOpenedScore, category, score); | 182 LogCategoryHistogramScore(kHistogramOpenedScore, category, score); |
| 183 | 183 |
| 184 UMA_HISTOGRAM_ENUMERATION(kHistogramOpenDisposition, disposition, | 184 UMA_HISTOGRAM_ENUMERATION( |
| 185 WINDOW_OPEN_DISPOSITION_LAST + 1); | 185 kHistogramOpenDisposition, static_cast<int>(disposition), |
| 186 LogCategoryHistogramEnumeration(kHistogramOpenDisposition, category, | 186 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); |
| 187 disposition, | 187 LogCategoryHistogramEnumeration( |
| 188 WINDOW_OPEN_DISPOSITION_LAST + 1); | 188 kHistogramOpenDisposition, category, static_cast<int>(disposition), |
| 189 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); |
| 189 } | 190 } |
| 190 | 191 |
| 191 void OnSuggestionMenuOpened(int global_position, | 192 void OnSuggestionMenuOpened(int global_position, |
| 192 Category category, | 193 Category category, |
| 193 int category_position, | 194 int category_position, |
| 194 base::Time publish_date, | 195 base::Time publish_date, |
| 195 float score) { | 196 float score) { |
| 196 UMA_HISTOGRAM_ENUMERATION(kHistogramMenuOpened, global_position, | 197 UMA_HISTOGRAM_ENUMERATION(kHistogramMenuOpened, global_position, |
| 197 kMaxSuggestionsTotal); | 198 kMaxSuggestionsTotal); |
| 198 LogCategoryHistogramEnumeration(kHistogramMenuOpened, category, | 199 LogCategoryHistogramEnumeration(kHistogramMenuOpened, category, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 218 | 219 |
| 219 void OnMoreButtonClicked(Category category, int position) { | 220 void OnMoreButtonClicked(Category category, int position) { |
| 220 // The "more" card can appear in addition to the actual suggestions, so add | 221 // The "more" card can appear in addition to the actual suggestions, so add |
| 221 // one extra bucket to this histogram. | 222 // one extra bucket to this histogram. |
| 222 LogCategoryHistogramEnumeration(kHistogramMoreButtonClicked, category, | 223 LogCategoryHistogramEnumeration(kHistogramMoreButtonClicked, category, |
| 223 position, kMaxSuggestionsPerCategory + 1); | 224 position, kMaxSuggestionsPerCategory + 1); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace metrics | 227 } // namespace metrics |
| 227 } // namespace ntp_snippets | 228 } // namespace ntp_snippets |
| OLD | NEW |