| 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 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | 5 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 6 | 6 |
| 7 namespace page_load_metrics { | 7 namespace page_load_metrics { |
| 8 | 8 |
| 9 PageLoadExtraInfo::PageLoadExtraInfo( | 9 PageLoadExtraInfo::PageLoadExtraInfo( |
| 10 const base::Optional<base::TimeDelta>& first_background_time, | 10 const base::Optional<base::TimeDelta>& first_background_time, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 did_commit(did_commit), | 27 did_commit(did_commit), |
| 28 page_end_reason(page_end_reason), | 28 page_end_reason(page_end_reason), |
| 29 page_end_user_initiated_info(page_end_user_initiated_info), | 29 page_end_user_initiated_info(page_end_user_initiated_info), |
| 30 page_end_time(page_end_time), | 30 page_end_time(page_end_time), |
| 31 metadata(metadata) {} | 31 metadata(metadata) {} |
| 32 | 32 |
| 33 PageLoadExtraInfo::PageLoadExtraInfo(const PageLoadExtraInfo& other) = default; | 33 PageLoadExtraInfo::PageLoadExtraInfo(const PageLoadExtraInfo& other) = default; |
| 34 | 34 |
| 35 PageLoadExtraInfo::~PageLoadExtraInfo() {} | 35 PageLoadExtraInfo::~PageLoadExtraInfo() {} |
| 36 | 36 |
| 37 // static |
| 38 PageLoadExtraInfo PageLoadExtraInfo::CreateForTesting( |
| 39 const GURL& url, |
| 40 bool started_in_foreground) { |
| 41 return PageLoadExtraInfo( |
| 42 base::Optional<base::TimeDelta>() /* first_background_time */, |
| 43 base::Optional<base::TimeDelta>() /* first_foreground_time */, |
| 44 started_in_foreground /* started_in_foreground */, |
| 45 UserInitiatedInfo::BrowserInitiated(), url, url, true /* did_commit */, |
| 46 page_load_metrics::END_NONE, |
| 47 page_load_metrics::UserInitiatedInfo::NotUserInitiated(), |
| 48 base::TimeDelta(), page_load_metrics::PageLoadMetadata()); |
| 49 } |
| 50 |
| 37 ExtraRequestInfo::ExtraRequestInfo(bool was_cached, | 51 ExtraRequestInfo::ExtraRequestInfo(bool was_cached, |
| 38 int64_t raw_body_bytes, | 52 int64_t raw_body_bytes, |
| 39 bool data_reduction_proxy_used, | 53 bool data_reduction_proxy_used, |
| 40 int64_t original_network_content_length) | 54 int64_t original_network_content_length) |
| 41 : was_cached(was_cached), | 55 : was_cached(was_cached), |
| 42 raw_body_bytes(raw_body_bytes), | 56 raw_body_bytes(raw_body_bytes), |
| 43 data_reduction_proxy_used(data_reduction_proxy_used), | 57 data_reduction_proxy_used(data_reduction_proxy_used), |
| 44 original_network_content_length(original_network_content_length) {} | 58 original_network_content_length(original_network_content_length) {} |
| 45 | 59 |
| 46 ExtraRequestInfo::ExtraRequestInfo(const ExtraRequestInfo& other) = default; | 60 ExtraRequestInfo::ExtraRequestInfo(const ExtraRequestInfo& other) = default; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 103 |
| 90 PageLoadMetricsObserver::ObservePolicy | 104 PageLoadMetricsObserver::ObservePolicy |
| 91 PageLoadMetricsObserver::ShouldObserveMimeType( | 105 PageLoadMetricsObserver::ShouldObserveMimeType( |
| 92 const std::string& mime_type) const { | 106 const std::string& mime_type) const { |
| 93 return mime_type == "text/html" || mime_type == "application/xhtml+xml" | 107 return mime_type == "text/html" || mime_type == "application/xhtml+xml" |
| 94 ? CONTINUE_OBSERVING | 108 ? CONTINUE_OBSERVING |
| 95 : STOP_OBSERVING; | 109 : STOP_OBSERVING; |
| 96 } | 110 } |
| 97 | 111 |
| 98 } // namespace page_load_metrics | 112 } // namespace page_load_metrics |
| OLD | NEW |