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

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: fix unit tests 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.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..394d5b47513f2d0489e423f1bc2e2545c872658c
--- /dev/null
+++ b/chrome/browser/previews/previews_infobar_delegate.h
@@ -0,0 +1,49 @@
+// 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;
+}
+
+class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate {
bengr 2016/08/25 23:26:19 Please add a class comment.
megjablon 2016/08/26 22:47:30 Done.
+ public:
+ // The type of the infobar. It controls the strings and what UMA data is
bengr 2016/08/25 23:26:19 Strings shoudn't be affected.
megjablon 2016/08/26 22:47:30 The offline infobar gets "Faster page loaded." ins
+ // 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:
bengr 2016/08/25 23:26:19 add the word "overrides"
megjablon 2016/08/26 22:47:30 Adding this back in. pkasting asked me to remove i
Peter Kasting 2016/08/27 03:42:22 Heh. There's no consistency across the codebase.
+ 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