| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/observers/data_reduction_proxy_metric
s_observer.h" | 5 #include "chrome/browser/page_load_metrics/observers/data_reduction_proxy_metric
s_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | 127 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
| 128 DataReductionProxyMetricsObserver::OnHidden( | 128 DataReductionProxyMetricsObserver::OnHidden( |
| 129 const page_load_metrics::PageLoadTiming& timing, | 129 const page_load_metrics::PageLoadTiming& timing, |
| 130 const page_load_metrics::PageLoadExtraInfo& info) { | 130 const page_load_metrics::PageLoadExtraInfo& info) { |
| 131 SendPingback(timing, info); | 131 SendPingback(timing, info); |
| 132 return STOP_OBSERVING; | 132 return STOP_OBSERVING; |
| 133 } | 133 } |
| 134 | 134 |
| 135 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
| 136 DataReductionProxyMetricsObserver::FlushMetricsOnAppEnterBackground( |
| 137 const page_load_metrics::PageLoadTiming& timing, |
| 138 const page_load_metrics::PageLoadExtraInfo& info) { |
| 139 // FlushMetricsOnAppEnterBackground is invoked on Android in cases where the |
| 140 // app is about to be backgrounded, as part of the Activity.onPause() |
| 141 // flow. After this method is invoked, Chrome may be killed without further |
| 142 // notification, so we send a pingback with data collected up to this point. |
| 143 SendPingback(timing, info); |
| 144 return STOP_OBSERVING; |
| 145 } |
| 146 |
| 135 void DataReductionProxyMetricsObserver::OnComplete( | 147 void DataReductionProxyMetricsObserver::OnComplete( |
| 136 const page_load_metrics::PageLoadTiming& timing, | 148 const page_load_metrics::PageLoadTiming& timing, |
| 137 const page_load_metrics::PageLoadExtraInfo& info) { | 149 const page_load_metrics::PageLoadExtraInfo& info) { |
| 138 SendPingback(timing, info); | 150 SendPingback(timing, info); |
| 139 } | 151 } |
| 140 | 152 |
| 141 void DataReductionProxyMetricsObserver::SendPingback( | 153 void DataReductionProxyMetricsObserver::SendPingback( |
| 142 const page_load_metrics::PageLoadTiming& timing, | 154 const page_load_metrics::PageLoadTiming& timing, |
| 143 const page_load_metrics::PageLoadExtraInfo& info) { | 155 const page_load_metrics::PageLoadExtraInfo& info) { |
| 144 // TODO(ryansturm): Move to OnFirstBackgroundEvent to handle some fast | 156 // TODO(ryansturm): Move to OnFirstBackgroundEvent to handle some fast |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 286 |
| 275 DataReductionProxyPingbackClient* | 287 DataReductionProxyPingbackClient* |
| 276 DataReductionProxyMetricsObserver::GetPingbackClient() const { | 288 DataReductionProxyMetricsObserver::GetPingbackClient() const { |
| 277 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 289 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 278 browser_context_) | 290 browser_context_) |
| 279 ->data_reduction_proxy_service() | 291 ->data_reduction_proxy_service() |
| 280 ->pingback_client(); | 292 ->pingback_client(); |
| 281 } | 293 } |
| 282 | 294 |
| 283 } // namespace data_reduction_proxy | 295 } // namespace data_reduction_proxy |
| OLD | NEW |