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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
7
8 #include "components/infobars/core/confirm_infobar_delegate.h"
9
10 namespace content {
11 class WebContents;
12 }
13
14 // Shows an infobar that lets the user know that a preview page has been loaded,
15 // and gives the user a link to reload the original page. This infobar will only
16 // be shown once per page load. Records UMA data for user interactions with the
17 // infobar.
18 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate {
19 public:
20 // The type of the infobar. It controls the strings and what UMA data is
21 // recorded for the infobar.
22 enum PreviewsInfoBarType {
23 LOFI, // Server-side image replacement.
24 LITE_PAGE, // Server-side page rewrite.
25 OFFLINE, // Offline copy of the page.
26 };
27
28 ~PreviewsInfoBarDelegate() override;
29
30 // Creates a preview infobar and corresponding delegate and adds the infobar
31 // to InfoBarService.
32 static void Create(content::WebContents* web_contents,
33 PreviewsInfoBarType infobar_type);
34
35 private:
36 PreviewsInfoBarDelegate(content::WebContents* web_contents,
37 PreviewsInfoBarType infobar_type);
38
39 // ConfirmInfoBarDelegate overrides:
40 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
41 int GetIconId() const override;
42 bool ShouldExpire(const NavigationDetails& details) const override;
43 base::string16 GetMessageText() const override;
44 int GetButtons() const override;
45 base::string16 GetLinkText() const override;
46 bool LinkClicked(WindowOpenDisposition disposition) override;
47
48 PreviewsInfoBarType infobar_type_;
49
50 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate);
51 };
52
53 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698