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

Unified Diff: chrome/browser/previews/previews_infobar_delegate.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_delegate.cc
diff --git a/chrome/browser/previews/previews_infobar_delegate.cc b/chrome/browser/previews/previews_infobar_delegate.cc
index 55ad0e3a4f03d5401e5097817e285a2dbaf4436c..e8c96945b3833bbb223ef519fcd86a284dc8a7c6 100644
--- a/chrome/browser/previews/previews_infobar_delegate.cc
+++ b/chrome/browser/previews/previews_infobar_delegate.cc
@@ -55,6 +55,7 @@ PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() {
void PreviewsInfoBarDelegate::Create(
content::WebContents* web_contents,
PreviewsInfoBarType infobar_type,
+ bool is_data_saver_user,
const OnDismissPreviewsInfobarCallback& on_dismiss_callback) {
PreviewsInfoBarTabHelper* infobar_tab_helper =
PreviewsInfoBarTabHelper::FromWebContents(web_contents);
@@ -67,7 +68,8 @@ void PreviewsInfoBarDelegate::Create(
infobars::InfoBar* infobar =
infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate>(new PreviewsInfoBarDelegate(
- web_contents, infobar_type, on_dismiss_callback))));
+ web_contents, infobar_type, is_data_saver_user,
+ on_dismiss_callback))));
if (infobar && (infobar_type == LITE_PAGE || infobar_type == LOFI)) {
auto* data_reduction_proxy_settings =
@@ -83,9 +85,11 @@ void PreviewsInfoBarDelegate::Create(
PreviewsInfoBarDelegate::PreviewsInfoBarDelegate(
content::WebContents* web_contents,
PreviewsInfoBarType infobar_type,
+ bool is_data_saver_user,
const OnDismissPreviewsInfobarCallback& on_dismiss_callback)
: ConfirmInfoBarDelegate(),
infobar_type_(infobar_type),
+ is_data_saver_user_(is_data_saver_user),
on_dismiss_callback_(on_dismiss_callback) {}
infobars::InfoBarDelegate::InfoBarIdentifier
@@ -112,9 +116,9 @@ void PreviewsInfoBarDelegate::InfoBarDismissed() {
}
base::string16 PreviewsInfoBarDelegate::GetMessageText() const {
- return l10n_util::GetStringUTF16((infobar_type_ == OFFLINE)
- ? IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE
- : IDS_PREVIEWS_INFOBAR_SAVED_DATA_TITLE);
+ return l10n_util::GetStringUTF16(
+ (is_data_saver_user_) ? IDS_PREVIEWS_INFOBAR_SAVED_DATA_TITLE
bengr 2016/12/16 00:38:43 Seems you want to choose a string when you create
RyanSturm 2016/12/16 19:02:09 Done.
+ : IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE);
}
int PreviewsInfoBarDelegate::GetButtons() const {

Powered by Google App Engine
This is Rietveld 408576698