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

Side by Side Diff: chrome/browser/previews/previews_infobar_tab_helper.cc

Issue 2815653003: IPH - connect data saver previews (Closed)
Patch Set: Moved event tracking to the IPH infobar support Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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/previews/previews_infobar_tab_helper.h" 5 #include "chrome/browser/previews/previews_infobar_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/feature_engagement_tracker/feature_engagement_tracker_f actory.h"
nyquist 2017/04/27 05:47:17 Nit: Are you sure you need to edit this file?
David Trainor- moved to gerrit 2017/04/28 00:57:46 D'oh!
9 #include "chrome/browser/loader/chrome_navigation_data.h" 10 #include "chrome/browser/loader/chrome_navigation_data.h"
10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 12 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
12 #include "chrome/browser/previews/previews_infobar_delegate.h" 13 #include "chrome/browser/previews/previews_infobar_delegate.h"
13 #include "chrome/browser/previews/previews_service.h" 14 #include "chrome/browser/previews/previews_service.h"
14 #include "chrome/browser/previews/previews_service_factory.h" 15 #include "chrome/browser/previews/previews_service_factory.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h" 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h"
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 95
95 #if defined(OS_ANDROID) 96 #if defined(OS_ANDROID)
96 offline_pages::OfflinePageTabHelper* tab_helper = 97 offline_pages::OfflinePageTabHelper* tab_helper =
97 offline_pages::OfflinePageTabHelper::FromWebContents(web_contents()); 98 offline_pages::OfflinePageTabHelper::FromWebContents(web_contents());
98 99
99 if (tab_helper && tab_helper->IsShowingOfflinePreview()) { 100 if (tab_helper && tab_helper->IsShowingOfflinePreview()) {
100 if (navigation_handle->IsErrorPage()) { 101 if (navigation_handle->IsErrorPage()) {
101 // TODO(ryansturm): Add UMA for errors. 102 // TODO(ryansturm): Add UMA for errors.
102 return; 103 return;
103 } 104 }
105
104 data_reduction_proxy::DataReductionProxySettings* 106 data_reduction_proxy::DataReductionProxySettings*
105 data_reduction_proxy_settings = 107 data_reduction_proxy_settings =
106 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 108 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
107 web_contents()->GetBrowserContext()); 109 web_contents()->GetBrowserContext());
108 PreviewsInfoBarDelegate::Create( 110 PreviewsInfoBarDelegate::Create(
109 web_contents(), PreviewsInfoBarDelegate::OFFLINE, 111 web_contents(), PreviewsInfoBarDelegate::OFFLINE,
110 data_reduction_proxy_settings && 112 data_reduction_proxy_settings &&
111 data_reduction_proxy_settings->IsDataReductionProxyEnabled(), 113 data_reduction_proxy_settings->IsDataReductionProxyEnabled(),
112 base::Bind(&AddPreviewNavigationCallback, browser_context_, 114 base::Bind(&AddPreviewNavigationCallback, browser_context_,
113 navigation_handle->GetURL(), 115 navigation_handle->GetURL(),
(...skipping 20 matching lines...) Expand all
134 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 136 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
135 browser_context_); 137 browser_context_);
136 if (!data_reduction_proxy_settings || 138 if (!data_reduction_proxy_settings ||
137 !data_reduction_proxy_settings->data_reduction_proxy_service()) { 139 !data_reduction_proxy_settings->data_reduction_proxy_service()) {
138 return; 140 return;
139 } 141 }
140 data_reduction_proxy_settings->data_reduction_proxy_service() 142 data_reduction_proxy_settings->data_reduction_proxy_service()
141 ->pingback_client() 143 ->pingback_client()
142 ->ClearNavigationKeyAsync(committed_data_saver_navigation_id_.value()); 144 ->ClearNavigationKeyAsync(committed_data_saver_navigation_id_.value());
143 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698