| 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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | 167 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
| 168 DataReductionProxyMetricsObserver::FlushMetricsOnAppEnterBackground( | 168 DataReductionProxyMetricsObserver::FlushMetricsOnAppEnterBackground( |
| 169 const page_load_metrics::PageLoadTiming& timing, | 169 const page_load_metrics::PageLoadTiming& timing, |
| 170 const page_load_metrics::PageLoadExtraInfo& info) { | 170 const page_load_metrics::PageLoadExtraInfo& info) { |
| 171 // FlushMetricsOnAppEnterBackground is invoked on Android in cases where the | 171 // FlushMetricsOnAppEnterBackground is invoked on Android in cases where the |
| 172 // app is about to be backgrounded, as part of the Activity.onPause() | 172 // app is about to be backgrounded, as part of the Activity.onPause() |
| 173 // flow. After this method is invoked, Chrome may be killed without further | 173 // flow. After this method is invoked, Chrome may be killed without further |
| 174 // notification, so we send a pingback with data collected up to this point. | 174 // notification, so we send a pingback with data collected up to this point. |
| 175 if (!info.committed_url.is_empty()) { | 175 if (info.did_commit) { |
| 176 RecordPageSizeUMA(); | 176 RecordPageSizeUMA(); |
| 177 SendPingback(timing, info); | 177 SendPingback(timing, info); |
| 178 } | 178 } |
| 179 return STOP_OBSERVING; | 179 return STOP_OBSERVING; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void DataReductionProxyMetricsObserver::OnComplete( | 182 void DataReductionProxyMetricsObserver::OnComplete( |
| 183 const page_load_metrics::PageLoadTiming& timing, | 183 const page_load_metrics::PageLoadTiming& timing, |
| 184 const page_load_metrics::PageLoadExtraInfo& info) { | 184 const page_load_metrics::PageLoadExtraInfo& info) { |
| 185 RecordPageSizeUMA(); | 185 RecordPageSizeUMA(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 DataReductionProxyPingbackClient* | 428 DataReductionProxyPingbackClient* |
| 429 DataReductionProxyMetricsObserver::GetPingbackClient() const { | 429 DataReductionProxyMetricsObserver::GetPingbackClient() const { |
| 430 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 430 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 431 browser_context_) | 431 browser_context_) |
| 432 ->data_reduction_proxy_service() | 432 ->data_reduction_proxy_service() |
| 433 ->pingback_client(); | 433 ->pingback_client(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace data_reduction_proxy | 436 } // namespace data_reduction_proxy |
| OLD | NEW |