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/prerender/prerender_histograms.h" | 5 #include "chrome/browser/prerender/prerender_histograms.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 case ORIGIN_EXTERNAL_REQUEST: | 61 case ORIGIN_EXTERNAL_REQUEST: |
62 return ComposeHistogramName("externalrequest", name); | 62 return ComposeHistogramName("externalrequest", name); |
63 case ORIGIN_INSTANT: | 63 case ORIGIN_INSTANT: |
64 return ComposeHistogramName("Instant", name); | 64 return ComposeHistogramName("Instant", name); |
65 case ORIGIN_LINK_REL_NEXT: | 65 case ORIGIN_LINK_REL_NEXT: |
66 return ComposeHistogramName("webnext", name); | 66 return ComposeHistogramName("webnext", name); |
67 case ORIGIN_GWS_PRERENDER: // Handled above. | 67 case ORIGIN_GWS_PRERENDER: // Handled above. |
68 default: | 68 default: |
69 NOTREACHED(); | 69 NOTREACHED(); |
70 break; | 70 break; |
71 }; | 71 } |
72 | 72 |
73 // Dummy return value to make the compiler happy. | 73 // Dummy return value to make the compiler happy. |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 return ComposeHistogramName("wash", name); | 75 return ComposeHistogramName("wash", name); |
76 } | 76 } |
77 | 77 |
78 bool OriginIsOmnibox(Origin origin) { | 78 bool OriginIsOmnibox(Origin origin) { |
79 return origin == ORIGIN_OMNIBOX; | 79 return origin == ORIGIN_OMNIBOX; |
80 } | 80 } |
81 | 81 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 391 } |
392 if (mc_status == PrerenderContents::MATCH_COMPLETE_DEFAULT || | 392 if (mc_status == PrerenderContents::MATCH_COMPLETE_DEFAULT || |
393 mc_status == PrerenderContents::MATCH_COMPLETE_REPLACEMENT || | 393 mc_status == PrerenderContents::MATCH_COMPLETE_REPLACEMENT || |
394 mc_status == PrerenderContents::MATCH_COMPLETE_REPLACEMENT_PENDING) { | 394 mc_status == PrerenderContents::MATCH_COMPLETE_REPLACEMENT_PENDING) { |
395 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( | 395 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( |
396 "FinalStatusMatchComplete", origin, experiment_id, | 396 "FinalStatusMatchComplete", origin, experiment_id, |
397 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); | 397 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 void PrerenderHistograms::RecordEvent(Origin origin, uint8 experiment_id, | |
402 PrerenderEvent event) const { | |
403 DCHECK_LT(event, PRERENDER_EVENT_MAX); | |
404 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( | |
405 "Event", origin, experiment_id, | |
406 UMA_HISTOGRAM_ENUMERATION(name, event, PRERENDER_EVENT_MAX)); | |
407 } | |
408 | |
409 void PrerenderHistograms::RecordCookieStatus(Origin origin, | 401 void PrerenderHistograms::RecordCookieStatus(Origin origin, |
410 uint8 experiment_id, | 402 uint8 experiment_id, |
411 int cookie_status) const { | 403 int cookie_status) const { |
412 DCHECK_GE(cookie_status, 0); | 404 DCHECK_GE(cookie_status, 0); |
413 DCHECK_LT(cookie_status, PrerenderContents::kNumCookieStatuses); | 405 DCHECK_LT(cookie_status, PrerenderContents::kNumCookieStatuses); |
414 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( | 406 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( |
415 "CookieStatus", origin, experiment_id, | 407 "CookieStatus", origin, experiment_id, |
416 UMA_HISTOGRAM_ENUMERATION(name, cookie_status, | 408 UMA_HISTOGRAM_ENUMERATION(name, cookie_status, |
417 PrerenderContents::kNumCookieStatuses)); | 409 PrerenderContents::kNumCookieStatuses)); |
418 } | 410 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return last_experiment_id_; | 468 return last_experiment_id_; |
477 } | 469 } |
478 | 470 |
479 bool PrerenderHistograms::IsOriginExperimentWash() const { | 471 bool PrerenderHistograms::IsOriginExperimentWash() const { |
480 if (!WithinWindow()) | 472 if (!WithinWindow()) |
481 return false; | 473 return false; |
482 return origin_experiment_wash_; | 474 return origin_experiment_wash_; |
483 } | 475 } |
484 | 476 |
485 } // namespace prerender | 477 } // namespace prerender |
OLD | NEW |