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

Unified Diff: chrome/browser/previews/previews_infobar_tab_helper.cc

Issue 2581533003: Show the Data Saver string for offline previews when Data Saver is enabled (Closed)
Patch Set: bengr comments Created 4 years 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
« no previous file with comments | « chrome/browser/previews/previews_infobar_delegate_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/previews/previews_infobar_tab_helper.cc
diff --git a/chrome/browser/previews/previews_infobar_tab_helper.cc b/chrome/browser/previews/previews_infobar_tab_helper.cc
index dcca36013ffe673e520f57e62189758221cab5b1..a3b8de98fd3305d7db71e22bb4cb4798bd0fbd9d 100644
--- a/chrome/browser/previews/previews_infobar_tab_helper.cc
+++ b/chrome/browser/previews/previews_infobar_tab_helper.cc
@@ -6,11 +6,14 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/previews/previews_infobar_delegate.h"
#include "chrome/browser/previews/previews_service.h"
#include "chrome/browser/previews/previews_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/features.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/previews/core/previews_experiments.h"
#include "components/previews/core/previews_ui_service.h"
@@ -75,9 +78,15 @@ void PreviewsInfoBarTabHelper::DidFinishNavigation(
// TODO(ryansturm): Add UMA for errors.
return;
}
+ data_reduction_proxy::DataReductionProxySettings*
+ data_reduction_proxy_settings =
+ DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
+ web_contents()->GetBrowserContext());
is_showing_offline_preview_ = true;
PreviewsInfoBarDelegate::Create(
web_contents(), PreviewsInfoBarDelegate::OFFLINE,
+ data_reduction_proxy_settings &&
+ data_reduction_proxy_settings->IsDataReductionProxyEnabled(),
base::Bind(
&AddPreviewNavigationCallback, web_contents()->GetBrowserContext(),
navigation_handle->GetURL(), previews::PreviewsType::OFFLINE));
@@ -91,6 +100,7 @@ void PreviewsInfoBarTabHelper::DidFinishNavigation(
if (headers && data_reduction_proxy::IsLitePagePreview(*headers)) {
PreviewsInfoBarDelegate::Create(
web_contents(), PreviewsInfoBarDelegate::LITE_PAGE,
+ true /* is_data_saver_user */,
PreviewsInfoBarDelegate::OnDismissPreviewsInfobarCallback());
}
}
« no previous file with comments | « chrome/browser/previews/previews_infobar_delegate_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698