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..6637557c394dfdcf1642de78c26cfee6da42b2d1 |
--- /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 |
bengr
2016/08/31 23:37:34
uma -> UMA
megjablon
2016/09/08 00:25:45
Done.
|
+// 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_ |