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

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

Issue 2256383002: Add PreviewsInfoBarTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@newLoFiInfoBarWithoutPercent
Patch Set: avi comment Created 4 years, 4 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/previews/previews_infobar_delegate.cc
diff --git a/chrome/browser/previews/previews_infobar_delegate.cc b/chrome/browser/previews/previews_infobar_delegate.cc
index df13511b734b951260e0736a9023cb3e11624193..2c2c527f9971b782cf3f621b3876e5ca5857c8da 100644
--- a/chrome/browser/previews/previews_infobar_delegate.cc
+++ b/chrome/browser/previews/previews_infobar_delegate.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/infobars/infobar_service.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_tab_helper.h"
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/infobar.h"
#include "content/public/browser/render_frame_host.h"
@@ -19,7 +20,10 @@ PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() {}
// static
void PreviewsInfoBarDelegate::Create(content::WebContents* web_contents,
PreviewsInfoBarType infobar_type) {
- // TODO(megjablon): Check that the infobar was not already shown.
+ PreviewsInfoBarTabHelper* infobar_tab_helper =
+ PreviewsInfoBarTabHelper::FromWebContents(web_contents);
+ if (infobar_tab_helper->DisplayedPreviewInfoBar())
bengr 2016/08/31 23:27:04 Can infobar_tab_helper be null?
megjablon 2016/09/08 00:25:15 The PreviewsInfoBarTabHelper is created in AttachT
+ return;
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
@@ -35,6 +39,8 @@ void PreviewsInfoBarDelegate::Create(content::WebContents* web_contents,
web_contents->GetBrowserContext());
data_reduction_proxy_settings->IncrementLoFiUIShown();
}
+
+ infobar_tab_helper->SetDisplayedPreviewInfoBar(true);
}
PreviewsInfoBarDelegate::PreviewsInfoBarDelegate(

Powered by Google App Engine
This is Rietveld 408576698