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

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

Issue 2250223002: Add InfoBar delegate for previews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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.h
diff --git a/chrome/browser/previews/previews_infobar_delegate.h b/chrome/browser/previews/previews_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..002f003d5ccc284aadecad97b10064986741aff8
--- /dev/null
+++ b/chrome/browser/previews/previews_infobar_delegate.h
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
+
+#include "components/infobars/core/confirm_infobar_delegate.h"
+
+namespace content {
+class WebContents;
+}
+
+// Shows an infobar that lets the user know that a preview page has been loaded,
+// and gives the user a link to reload the original page. This infobar will only
+// be shown once per page load. Records UMA data for user interactions with the
+// infobar.
+class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ // The type of the infobar. It controls the strings and what UMA data is
+ // recorded for the infobar.
+ enum PreviewsInfoBarType {
+ LOFI, // Server-side image replacement.
+ LITE_PAGE, // Server-side page rewrite.
+ OFFLINE, // Offline copy of the page.
+ };
+
+ ~PreviewsInfoBarDelegate() override;
+
+ // Creates a preview infobar and corresponding delegate and adds the infobar
+ // to InfoBarService.
+ static void Create(content::WebContents* web_contents,
+ PreviewsInfoBarType infobar_type);
+
+ private:
+ PreviewsInfoBarDelegate(content::WebContents* web_contents,
+ PreviewsInfoBarType infobar_type);
+
+ // ConfirmInfoBarDelegate overrides:
+ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
+ int GetIconId() const override;
+ bool ShouldExpire(const NavigationDetails& details) const override;
+ base::string16 GetMessageText() const override;
+ int GetButtons() const override;
+ base::string16 GetLinkText() const override;
+ bool LinkClicked(WindowOpenDisposition disposition) override;
+
+ PreviewsInfoBarType infobar_type_;
+
+ DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698