OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ |
7 | 7 |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/optional.h" | 9 #include "base/optional.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 base::Optional<base::TimeDelta> OptionalMin( | 124 base::Optional<base::TimeDelta> OptionalMin( |
125 const base::Optional<base::TimeDelta>& a, | 125 const base::Optional<base::TimeDelta>& a, |
126 const base::Optional<base::TimeDelta>& b); | 126 const base::Optional<base::TimeDelta>& b); |
127 | 127 |
128 // Whether the given loading behavior was observed in any frame (either the main | 128 // Whether the given loading behavior was observed in any frame (either the main |
129 // frame or a subframe). | 129 // frame or a subframe). |
130 bool DidObserveLoadingBehaviorInAnyFrame( | 130 bool DidObserveLoadingBehaviorInAnyFrame( |
131 const page_load_metrics::PageLoadExtraInfo& info, | 131 const page_load_metrics::PageLoadExtraInfo& info, |
132 blink::WebLoadingBehaviorFlag behavior); | 132 blink::WebLoadingBehaviorFlag behavior); |
133 | 133 |
| 134 // Whether the given url has a google hostname. |
| 135 bool IsGoogleHostname(const GURL& url); |
| 136 |
| 137 // If the given hostname is a google hostname, returns the portion of the |
| 138 // hostname before the google hostname. Otherwise, returns an unset optional |
| 139 // value. |
| 140 // |
| 141 // For example: |
| 142 // https://example.com/foo => returns an unset optional value |
| 143 // https://google.com/foo => returns '' |
| 144 // https://www.google.com/foo => returns 'www' |
| 145 // https://news.google.com/foo => returns 'news' |
| 146 // https://a.b.c.google.com/foo => returns 'a.b.c' |
| 147 base::Optional<std::string> GetGoogleHostnamePrefix(const GURL& url); |
| 148 |
134 } // namespace page_load_metrics | 149 } // namespace page_load_metrics |
135 | 150 |
136 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ | 151 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ |
OLD | NEW |