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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 base::Optional<base::TimeDelta> GetInitialForegroundDuration( | 127 base::Optional<base::TimeDelta> GetInitialForegroundDuration( |
128 const PageLoadExtraInfo& info, | 128 const PageLoadExtraInfo& info, |
129 base::TimeTicks app_background_time); | 129 base::TimeTicks app_background_time); |
130 | 130 |
131 // Whether the given loading behavior was observed in any frame (either the main | 131 // Whether the given loading behavior was observed in any frame (either the main |
132 // frame or a subframe). | 132 // frame or a subframe). |
133 bool DidObserveLoadingBehaviorInAnyFrame( | 133 bool DidObserveLoadingBehaviorInAnyFrame( |
134 const page_load_metrics::PageLoadExtraInfo& info, | 134 const page_load_metrics::PageLoadExtraInfo& info, |
135 blink::WebLoadingBehaviorFlag behavior); | 135 blink::WebLoadingBehaviorFlag behavior); |
136 | 136 |
| 137 // Whether the given url has a Google Search hostname. |
| 138 // Examples: |
| 139 // https://www.google.com -> true |
| 140 // https://www.google.co.jp -> true |
| 141 // https://www.google.example.com -> false |
| 142 // https://docs.google.com -> false |
| 143 bool IsGoogleSearchHostname(const GURL& url); |
| 144 |
| 145 // Whether the given url is for a Google Search results page. See |
| 146 // https://docs.google.com/document/d/1jNPZ6Aeh0KV6umw1yZrrkfXRfxWNruwu7FELLx_cp
Og/edit |
| 147 // for additional details. |
| 148 // Examples: |
| 149 // https://www.google.com/#q=test -> true |
| 150 // https://www.google.com/search?q=test -> true |
| 151 // https://www.google.com/ -> false |
| 152 // https://www.google.com/about/ -> false |
| 153 bool IsGoogleSearchResultUrl(const GURL& url); |
| 154 |
| 155 // Whether the given url is a Google Search redirector URL. |
| 156 bool IsGoogleSearchRedirectorUrl(const GURL& url); |
| 157 |
| 158 // Whether the given query string contains the given component. The query |
| 159 // parameter should contain the query string of a URL (the portion following |
| 160 // the question mark, excluding the question mark). The component must fully |
| 161 // match a component in the query string. For example, 'foo=bar' would match |
| 162 // the query string 'a=b&foo=bar&c=d' but would not match 'a=b&zzzfoo=bar&c=d' |
| 163 // since, though foo=bar appears in the query string, the key specified in the |
| 164 // component 'foo' does not match the full key in the query string |
| 165 // 'zzzfoo'. For QueryContainsComponent, the component should of the form |
| 166 // 'key=value'. For QueryContainsComponentPrefix, the component should be of |
| 167 // the form 'key=' (where the value is not specified). |
| 168 bool QueryContainsComponent(const base::StringPiece query, |
| 169 const base::StringPiece component); |
| 170 bool QueryContainsComponentPrefix(const base::StringPiece query, |
| 171 const base::StringPiece component); |
| 172 |
137 } // namespace page_load_metrics | 173 } // namespace page_load_metrics |
138 | 174 |
139 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ | 175 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_ |
OLD | NEW |