OLD | NEW |
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 "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 INFOBAR_LOAD_ORIGINAL_CLICKED = 1, | 36 INFOBAR_LOAD_ORIGINAL_CLICKED = 1, |
37 INFOBAR_DISMISSED_BY_USER = 2, | 37 INFOBAR_DISMISSED_BY_USER = 2, |
38 INFOBAR_DISMISSED_BY_NAVIGATION = 3, | 38 INFOBAR_DISMISSED_BY_NAVIGATION = 3, |
39 INFOBAR_DISMISSED_BY_RELOAD = 4, | 39 INFOBAR_DISMISSED_BY_RELOAD = 4, |
40 INFOBAR_DISMISSED_BY_TAB_CLOSURE = 5, | 40 INFOBAR_DISMISSED_BY_TAB_CLOSURE = 5, |
41 INFOBAR_INDEX_BOUNDARY | 41 INFOBAR_INDEX_BOUNDARY |
42 }; | 42 }; |
43 | 43 |
44 ~PreviewsInfoBarDelegate() override; | 44 ~PreviewsInfoBarDelegate() override; |
45 | 45 |
| 46 PreviewsInfoBarDelegate* AsPreviewsInfoBarDelegate() override; |
| 47 |
46 // Creates a preview infobar and corresponding delegate and adds the infobar | 48 // Creates a preview infobar and corresponding delegate and adds the infobar |
47 // to InfoBarService. | 49 // to InfoBarService. |
48 static void Create( | 50 static void Create( |
49 content::WebContents* web_contents, | 51 content::WebContents* web_contents, |
50 PreviewsInfoBarType infobar_type, | 52 PreviewsInfoBarType infobar_type, |
51 bool is_data_saver_user, | 53 bool is_data_saver_user, |
52 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 54 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
53 | 55 |
| 56 // ConfirmInfoBarDelegate overrides: |
| 57 base::string16 GetMessageText() const override; |
| 58 base::string16 GetLinkText() const override; |
| 59 |
| 60 base::string16 GetTimestampText() const; |
| 61 |
54 private: | 62 private: |
55 PreviewsInfoBarDelegate( | 63 PreviewsInfoBarDelegate( |
56 content::WebContents* web_contents, | 64 content::WebContents* web_contents, |
57 PreviewsInfoBarType infobar_type, | 65 PreviewsInfoBarType infobar_type, |
58 bool is_data_saver_user, | 66 bool is_data_saver_user, |
59 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 67 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
60 | 68 |
61 // ConfirmInfoBarDelegate overrides: | 69 // ConfirmInfoBarDelegate overrides: |
62 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 70 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
63 int GetIconId() const override; | 71 int GetIconId() const override; |
64 bool ShouldExpire(const NavigationDetails& details) const override; | 72 bool ShouldExpire(const NavigationDetails& details) const override; |
65 void InfoBarDismissed() override; | 73 void InfoBarDismissed() override; |
66 base::string16 GetMessageText() const override; | |
67 int GetButtons() const override; | 74 int GetButtons() const override; |
68 base::string16 GetLinkText() const override; | |
69 bool LinkClicked(WindowOpenDisposition disposition) override; | 75 bool LinkClicked(WindowOpenDisposition disposition) override; |
70 | 76 |
71 PreviewsInfoBarType infobar_type_; | 77 PreviewsInfoBarType infobar_type_; |
72 mutable PreviewsInfoBarAction infobar_dismissed_action_; | 78 mutable PreviewsInfoBarAction infobar_dismissed_action_; |
73 | 79 |
74 const base::string16 message_text_; | 80 const base::string16 message_text_; |
75 | 81 |
76 OnDismissPreviewsInfobarCallback on_dismiss_callback_; | 82 OnDismissPreviewsInfobarCallback on_dismiss_callback_; |
77 | 83 |
78 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); | 84 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); |
79 }; | 85 }; |
80 | 86 |
81 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 87 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
OLD | NEW |