OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_metrics.h" | 5 #include "content/browser/service_worker/service_worker_metrics.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // URL, but not available in content layer. | 203 // URL, but not available in content layer. |
204 static const char google_like_scope_prefix[] = "https://www.google."; | 204 static const char google_like_scope_prefix[] = "https://www.google."; |
205 static const char ntp_scope_path[] = "/_/chrome/"; | 205 static const char ntp_scope_path[] = "/_/chrome/"; |
206 if (base::StartsWith(url.spec(), google_like_scope_prefix, | 206 if (base::StartsWith(url.spec(), google_like_scope_prefix, |
207 base::CompareCase::INSENSITIVE_ASCII) && | 207 base::CompareCase::INSENSITIVE_ASCII) && |
208 base::StartsWith(url.path(), ntp_scope_path, | 208 base::StartsWith(url.path(), ntp_scope_path, |
209 base::CompareCase::SENSITIVE)) { | 209 base::CompareCase::SENSITIVE)) { |
210 return ServiceWorkerMetrics::Site::NEW_TAB_PAGE; | 210 return ServiceWorkerMetrics::Site::NEW_TAB_PAGE; |
211 } | 211 } |
212 | 212 |
213 const std::string host = url.host(); | |
214 if (host == "plus.google.com") | |
215 return ServiceWorkerMetrics::Site::PLUS; | |
216 if (host == "inbox.google.com") | |
217 return ServiceWorkerMetrics::Site::INBOX; | |
218 if (host == "docs.google.com" || host == "drive.google.com") | |
Mark P
2016/08/22 17:00:53
nit: parens around binary operators (==)
| |
219 return ServiceWorkerMetrics::Site::DOCS; | |
213 return ServiceWorkerMetrics::Site::OTHER; | 220 return ServiceWorkerMetrics::Site::OTHER; |
214 } | 221 } |
215 | 222 |
216 bool ServiceWorkerMetrics::IsNavigationHintEvent(EventType event_type) { | 223 bool ServiceWorkerMetrics::IsNavigationHintEvent(EventType event_type) { |
217 return event_type == EventType::NAVIGATION_HINT_LINK_MOUSE_DOWN || | 224 return event_type == EventType::NAVIGATION_HINT_LINK_MOUSE_DOWN || |
218 event_type == EventType::NAVIGATION_HINT_LINK_TAP_UNCONFIRMED || | 225 event_type == EventType::NAVIGATION_HINT_LINK_TAP_UNCONFIRMED || |
219 event_type == EventType::NAVIGATION_HINT_LINK_TAP_DOWN; | 226 event_type == EventType::NAVIGATION_HINT_LINK_TAP_DOWN; |
220 } | 227 } |
221 | 228 |
222 bool ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram(Site site) { | 229 bool ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram(Site site) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 } else if (failure_count == 2) { | 687 } else if (failure_count == 2) { |
681 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_2", | 688 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_2", |
682 status, SERVICE_WORKER_ERROR_MAX_VALUE); | 689 status, SERVICE_WORKER_ERROR_MAX_VALUE); |
683 } else if (failure_count == 3) { | 690 } else if (failure_count == 3) { |
684 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_3", | 691 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_3", |
685 status, SERVICE_WORKER_ERROR_MAX_VALUE); | 692 status, SERVICE_WORKER_ERROR_MAX_VALUE); |
686 } | 693 } |
687 } | 694 } |
688 | 695 |
689 } // namespace content | 696 } // namespace content |
OLD | NEW |