| 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::CreateForTest(const GURL& url, |
| 39 bool started_in_foreground) { |
| 40 return PageLoadExtraInfo( |
| 41 base::Optional<base::TimeDelta>() /* first_background_time */, |
| 42 base::Optional<base::TimeDelta>() /* first_foreground_time */, |
| 43 started_in_foreground /* started_in_foreground */, |
| 44 UserInitiatedInfo::BrowserInitiated(), url, url, true /* did_commit */, |
| 45 page_load_metrics::END_NONE, |
| 46 page_load_metrics::UserInitiatedInfo::NotUserInitiated(), |
| 47 base::TimeDelta(), page_load_metrics::PageLoadMetadata()); |
| 48 } |
| 49 |
| 37 ExtraRequestInfo::ExtraRequestInfo(bool was_cached, | 50 ExtraRequestInfo::ExtraRequestInfo(bool was_cached, |
| 38 int64_t raw_body_bytes, | 51 int64_t raw_body_bytes, |
| 39 bool data_reduction_proxy_used, | 52 bool data_reduction_proxy_used, |
| 40 int64_t original_network_content_length) | 53 int64_t original_network_content_length) |
| 41 : was_cached(was_cached), | 54 : was_cached(was_cached), |
| 42 raw_body_bytes(raw_body_bytes), | 55 raw_body_bytes(raw_body_bytes), |
| 43 data_reduction_proxy_used(data_reduction_proxy_used), | 56 data_reduction_proxy_used(data_reduction_proxy_used), |
| 44 original_network_content_length(original_network_content_length) {} | 57 original_network_content_length(original_network_content_length) {} |
| 45 | 58 |
| 46 ExtraRequestInfo::ExtraRequestInfo(const ExtraRequestInfo& other) = default; | 59 ExtraRequestInfo::ExtraRequestInfo(const ExtraRequestInfo& other) = default; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 102 |
| 90 PageLoadMetricsObserver::ObservePolicy | 103 PageLoadMetricsObserver::ObservePolicy |
| 91 PageLoadMetricsObserver::ShouldObserveMimeType( | 104 PageLoadMetricsObserver::ShouldObserveMimeType( |
| 92 const std::string& mime_type) const { | 105 const std::string& mime_type) const { |
| 93 return mime_type == "text/html" || mime_type == "application/xhtml+xml" | 106 return mime_type == "text/html" || mime_type == "application/xhtml+xml" |
| 94 ? CONTINUE_OBSERVING | 107 ? CONTINUE_OBSERVING |
| 95 : STOP_OBSERVING; | 108 : STOP_OBSERVING; |
| 96 } | 109 } |
| 97 | 110 |
| 98 } // namespace page_load_metrics | 111 } // namespace page_load_metrics |
| OLD | NEW |