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

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

Issue 2940083003: Add timestamp to infobar for stale Previews (Closed)
Patch Set: test fixes Created 3 years, 6 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
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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/time/time.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h" 11 #include "components/infobars/core/confirm_infobar_delegate.h"
11 #include "components/previews/core/previews_experiments.h" 12 #include "components/previews/core/previews_experiments.h"
12 13
13 namespace content { 14 namespace content {
14 class WebContents; 15 class WebContents;
15 } 16 }
16 17
17 // Shows an infobar that lets the user know that a preview page has been loaded, 18 // Shows an infobar that lets the user know that a preview page has been loaded,
18 // and gives the user a link to reload the original page. This infobar will only 19 // and gives the user a link to reload the original page. This infobar will only
19 // be shown once per page load. Records UMA data for user interactions with the 20 // be shown once per page load. Records UMA data for user interactions with the
(...skipping 14 matching lines...) Expand all
34 INFOBAR_INDEX_BOUNDARY 35 INFOBAR_INDEX_BOUNDARY
35 }; 36 };
36 37
37 ~PreviewsInfoBarDelegate() override; 38 ~PreviewsInfoBarDelegate() override;
38 39
39 // Creates a preview infobar and corresponding delegate and adds the infobar 40 // Creates a preview infobar and corresponding delegate and adds the infobar
40 // to InfoBarService. 41 // to InfoBarService.
41 static void Create( 42 static void Create(
42 content::WebContents* web_contents, 43 content::WebContents* web_contents,
43 previews::PreviewsType previews_type, 44 previews::PreviewsType previews_type,
45 base::Time previews_freshness,
44 bool is_data_saver_user, 46 bool is_data_saver_user,
45 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); 47 const OnDismissPreviewsInfobarCallback& on_dismiss_callback);
46 48
47 // ConfirmInfoBarDelegate overrides: 49 // ConfirmInfoBarDelegate overrides:
50 int GetIconId() const override;
48 base::string16 GetMessageText() const override; 51 base::string16 GetMessageText() const override;
49 base::string16 GetLinkText() const override; 52 base::string16 GetLinkText() const override;
50 53
51 base::string16 GetTimestampText() const; 54 base::string16 GetTimestampText() const;
52 55
53 private: 56 private:
54 PreviewsInfoBarDelegate( 57 PreviewsInfoBarDelegate(
55 content::WebContents* web_contents, 58 content::WebContents* web_contents,
56 previews::PreviewsType previews_type, 59 previews::PreviewsType previews_type,
60 base::Time previews_freshness,
57 bool is_data_saver_user, 61 bool is_data_saver_user,
58 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); 62 const OnDismissPreviewsInfobarCallback& on_dismiss_callback);
59 63
60 // ConfirmInfoBarDelegate overrides: 64 // ConfirmInfoBarDelegate overrides:
61 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 65 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
62 int GetIconId() const override;
63 bool ShouldExpire(const NavigationDetails& details) const override; 66 bool ShouldExpire(const NavigationDetails& details) const override;
64 void InfoBarDismissed() override; 67 void InfoBarDismissed() override;
65 int GetButtons() const override; 68 int GetButtons() const override;
66 bool LinkClicked(WindowOpenDisposition disposition) override; 69 bool LinkClicked(WindowOpenDisposition disposition) override;
67 70
68 previews::PreviewsType previews_type_; 71 previews::PreviewsType previews_type_;
72 base::Time previews_freshness_;
tbansal1 2017/06/19 20:52:29 Can this be a const variable?
tbansal1 2017/06/19 20:52:29 Add a variable comment? Seems like this is the tim
megjablon 2017/06/20 18:42:12 Done.
69 mutable PreviewsInfoBarAction infobar_dismissed_action_; 73 mutable PreviewsInfoBarAction infobar_dismissed_action_;
70 74
71 const base::string16 message_text_; 75 const base::string16 message_text_;
72 76
73 OnDismissPreviewsInfobarCallback on_dismiss_callback_; 77 OnDismissPreviewsInfobarCallback on_dismiss_callback_;
74 78
75 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); 79 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate);
76 }; 80 };
77 81
78 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ 82 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698