Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc

Issue 2362033002: Showing previews UI for Offline Previews (Closed)
Patch Set: megjablon comments rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
index e0a445497921a99852fed6905e4c743c7f78d0f7..d43162c3d7586bdbdf7c8e013c372a1077e2ff60 100644
--- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
@@ -95,28 +95,22 @@ page_load_metrics::PageLoadMetricsObserver::ObservePolicy
DataReductionProxyMetricsObserver::OnCommit(
content::NavigationHandle* navigation_handle) {
// This BrowserContext is valid for the lifetime of
// DataReductionProxyMetricsObserver. BrowserContext is always valid and
// non-nullptr in NavigationControllerImpl, which is a member of WebContents.
// A raw pointer to BrowserContext taken at this point will be valid until
// after WebContent's destructor. The latest that PageLoadTracker's destructor
// will be called is in MetricsWebContentsObserver's destrcutor, which is
// called in WebContents destructor.
browser_context_ = navigation_handle->GetWebContents()->GetBrowserContext();
- // As documented in content/public/browser/navigation_handle.h, this
- // NavigationData is a clone of the NavigationData instance returned from
- // ResourceDispatcherHostDelegate::GetNavigationData during commit.
- // Because ChromeResourceDispatcherHostDelegate always returns a
- // ChromeNavigationData, it is safe to static_cast here.
ChromeNavigationData* chrome_navigation_data =
- static_cast<ChromeNavigationData*>(
- navigation_handle->GetNavigationData());
+ ChromeNavigationData::GetForNavigationHandle(navigation_handle);
if (!chrome_navigation_data)
return STOP_OBSERVING;
data_reduction_proxy::DataReductionProxyData* data =
chrome_navigation_data->GetDataReductionProxyData();
if (!data)
return STOP_OBSERVING;
data_ = data->DeepCopy();
// DataReductionProxy page loads should only occur on HTTP navigations.
DCHECK(!data_->used_data_reduction_proxy() ||
!navigation_handle->GetURL().SchemeIsCryptographic());

Powered by Google App Engine
This is Rietveld 408576698