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

Side by Side Diff: chrome/browser/previews/previews_infobar_delegate.h

Issue 2266653002: Previews infobar tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@newLoFiInfoBarAddUMA
Patch Set: bengr comments 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
« no previous file with comments | « no previous file | chrome/browser/previews/previews_infobar_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
7 7
8 #include "components/infobars/core/confirm_infobar_delegate.h" 8 #include "components/infobars/core/confirm_infobar_delegate.h"
9 9
10 namespace content { 10 namespace content {
11 class WebContents; 11 class WebContents;
12 } 12 }
13 13
14 // Shows an infobar that lets the user know that a preview page has been loaded, 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 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 16 // be shown once per page load. Records UMA data for user interactions with the
17 // infobar. 17 // infobar.
18 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate { 18 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate {
19 public: 19 public:
20 // The type of the infobar. It controls the strings and what UMA data is 20 // The type of the infobar. It controls the strings and what UMA data is
21 // recorded for the infobar. 21 // recorded for the infobar.
22 enum PreviewsInfoBarType { 22 enum PreviewsInfoBarType {
23 LOFI, // Server-side image replacement. 23 LOFI, // Server-side image replacement.
24 LITE_PAGE, // Server-side page rewrite. 24 LITE_PAGE, // Server-side page rewrite.
25 OFFLINE, // Offline copy of the page. 25 OFFLINE, // Offline copy of the page.
26 }; 26 };
27 27
28 // Actions on the previews infobar. This enum must remain synchronized with
29 // the enum of the same name in metrics/histograms/histograms.xml.
30 enum PreviewsInfoBarAction {
31 INFOBAR_SHOWN = 0,
32 INFOBAR_LOAD_ORIGINAL_CLICKED = 1,
33 INFOBAR_DISMISSED_BY_USER = 2,
34 INFOBAR_DISMISSED_BY_NAVIGATION = 3,
35 INFOBAR_INDEX_BOUNDARY
36 };
37
28 ~PreviewsInfoBarDelegate() override; 38 ~PreviewsInfoBarDelegate() override;
29 39
30 // Creates a preview infobar and corresponding delegate and adds the infobar 40 // Creates a preview infobar and corresponding delegate and adds the infobar
31 // to InfoBarService. 41 // to InfoBarService.
32 static void Create(content::WebContents* web_contents, 42 static void Create(content::WebContents* web_contents,
33 PreviewsInfoBarType infobar_type); 43 PreviewsInfoBarType infobar_type);
34 44
35 private: 45 private:
36 PreviewsInfoBarDelegate(content::WebContents* web_contents, 46 PreviewsInfoBarDelegate(content::WebContents* web_contents,
37 PreviewsInfoBarType infobar_type); 47 PreviewsInfoBarType infobar_type);
38 48
39 // ConfirmInfoBarDelegate overrides: 49 // ConfirmInfoBarDelegate overrides:
40 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 50 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
41 int GetIconId() const override; 51 int GetIconId() const override;
42 bool ShouldExpire(const NavigationDetails& details) const override; 52 bool ShouldExpire(const NavigationDetails& details) const override;
43 void InfoBarDismissed() override; 53 void InfoBarDismissed() override;
44 base::string16 GetMessageText() const override; 54 base::string16 GetMessageText() const override;
45 int GetButtons() const override; 55 int GetButtons() const override;
46 base::string16 GetLinkText() const override; 56 base::string16 GetLinkText() const override;
47 bool LinkClicked(WindowOpenDisposition disposition) override; 57 bool LinkClicked(WindowOpenDisposition disposition) override;
48 58
49 PreviewsInfoBarType infobar_type_; 59 PreviewsInfoBarType infobar_type_;
50 60
51 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); 61 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate);
52 }; 62 };
53 63
54 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ 64 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/previews/previews_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698