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_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/optional.h" | 12 #include "base/optional.h" |
12 #include "chrome/common/page_load_metrics/page_load_timing.h" | 13 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data
.h" |
13 #include "content/public/browser/navigation_handle.h" | 15 #include "content/public/browser/navigation_handle.h" |
14 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
15 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 17 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
16 #include "url/gurl.h" | 18 #include "url/gurl.h" |
17 | 19 |
18 namespace page_load_metrics { | 20 namespace page_load_metrics { |
19 | 21 |
20 // This enum represents how a page load ends. If the action occurs before the | 22 // This enum represents how a page load ends. If the action occurs before the |
21 // page load finishes (or reaches some point like first paint), then we consider | 23 // page load finishes (or reaches some point like first paint), then we consider |
22 // the load to be aborted. | 24 // the load to be aborted. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const PageLoadMetadata main_frame_metadata; | 194 const PageLoadMetadata main_frame_metadata; |
193 | 195 |
194 // PageLoadMetadata for child frames of the current page load. | 196 // PageLoadMetadata for child frames of the current page load. |
195 const PageLoadMetadata child_frame_metadata; | 197 const PageLoadMetadata child_frame_metadata; |
196 }; | 198 }; |
197 | 199 |
198 // Container for various information about a request within a page load. | 200 // Container for various information about a request within a page load. |
199 struct ExtraRequestInfo { | 201 struct ExtraRequestInfo { |
200 ExtraRequestInfo(bool was_cached, | 202 ExtraRequestInfo(bool was_cached, |
201 int64_t raw_body_bytes, | 203 int64_t raw_body_bytes, |
202 bool data_reduction_proxy_used, | 204 int64_t original_network_content_length, |
203 int64_t original_network_content_length); | 205 std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
204 | 206 data_reduction_proxy_data); |
205 ExtraRequestInfo(const ExtraRequestInfo& other); | |
206 | 207 |
207 ~ExtraRequestInfo(); | 208 ~ExtraRequestInfo(); |
208 | 209 |
209 // True if the resource was loaded from cache. | 210 // True if the resource was loaded from cache. |
210 const bool was_cached; | 211 const bool was_cached; |
211 | 212 |
212 // The number of body (not header) prefilter bytes. | 213 // The number of body (not header) prefilter bytes. |
213 const int64_t raw_body_bytes; | 214 const int64_t raw_body_bytes; |
214 | 215 |
215 // Whether this request used Data Reduction Proxy. | |
216 const bool data_reduction_proxy_used; | |
217 | |
218 // The number of body (not header) bytes that the data reduction proxy saw | 216 // The number of body (not header) bytes that the data reduction proxy saw |
219 // before it compressed the requests. | 217 // before it compressed the requests. |
220 const int64_t original_network_content_length; | 218 const int64_t original_network_content_length; |
| 219 |
| 220 // Data related to data saver. |
| 221 const std::unique_ptr<data_reduction_proxy::DataReductionProxyData> |
| 222 data_reduction_proxy_data; |
221 }; | 223 }; |
222 | 224 |
223 // Interface for PageLoadMetrics observers. All instances of this class are | 225 // Interface for PageLoadMetrics observers. All instances of this class are |
224 // owned by the PageLoadTracker tracking a page load. | 226 // owned by the PageLoadTracker tracking a page load. |
225 class PageLoadMetricsObserver { | 227 class PageLoadMetricsObserver { |
226 public: | 228 public: |
227 // ObservePolicy is used as a return value on some PageLoadMetricsObserver | 229 // ObservePolicy is used as a return value on some PageLoadMetricsObserver |
228 // callbacks to indicate whether the observer would like to continue observing | 230 // callbacks to indicate whether the observer would like to continue observing |
229 // metric callbacks. Observers that wish to continue observing metric | 231 // metric callbacks. Observers that wish to continue observing metric |
230 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop | 232 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 377 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
376 const PageLoadExtraInfo& extra_info) {} | 378 const PageLoadExtraInfo& extra_info) {} |
377 | 379 |
378 // Called whenever a request is loaded for this page load. | 380 // Called whenever a request is loaded for this page load. |
379 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 381 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} |
380 }; | 382 }; |
381 | 383 |
382 } // namespace page_load_metrics | 384 } // namespace page_load_metrics |
383 | 385 |
384 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 386 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |