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

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: 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
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..8898531854af1f55e2dec6c157b67e9dcfe07d0f 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,19 @@ void PreviewsInfoBarTabHelper::DidFinishNavigation(
// TODO(ryansturm): Add UMA for errors.
return;
}
+ data_reduction_proxy::DataReductionProxySettings*
+ data_reduction_proxy_settings =
+ DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
+ web_contents()->GetBrowserContext());
+ bool is_data_saver_user = false;
+ if (data_reduction_proxy_settings) {
+ is_data_saver_user =
+ data_reduction_proxy_settings->IsDataReductionProxyEnabled();
+ }
is_showing_offline_preview_ = true;
PreviewsInfoBarDelegate::Create(
web_contents(), PreviewsInfoBarDelegate::OFFLINE,
+ is_data_saver_user /* is_data_saver_user*/,
bengr 2016/12/16 16:45:30 Why not just replace this with drp_settings && drp
RyanSturm 2016/12/16 19:02:10 Done.
base::Bind(
&AddPreviewNavigationCallback, web_contents()->GetBrowserContext(),
navigation_handle->GetURL(), previews::PreviewsType::OFFLINE));
@@ -91,6 +104,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());
}
}

Powered by Google App Engine
This is Rietveld 408576698