| 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 "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 class WebContents; | 13 class WebContents; |
| 13 } | 14 } |
| 14 | 15 |
| 15 // Shows an infobar that lets the user know that a preview page has been loaded, | 16 // Shows an infobar that lets the user know that a preview page has been loaded, |
| 16 // and gives the user a link to reload the original page. This infobar will only | 17 // and gives the user a link to reload the original page. This infobar will only |
| 17 // be shown once per page load. Records UMA data for user interactions with the | 18 // be shown once per page load. Records UMA data for user interactions with the |
| 18 // infobar. | 19 // infobar. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 INFOBAR_INDEX_BOUNDARY | 39 INFOBAR_INDEX_BOUNDARY |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 ~PreviewsInfoBarDelegate() override; | 42 ~PreviewsInfoBarDelegate() override; |
| 42 | 43 |
| 43 // Creates a preview infobar and corresponding delegate and adds the infobar | 44 // Creates a preview infobar and corresponding delegate and adds the infobar |
| 44 // to InfoBarService. | 45 // to InfoBarService. |
| 45 static void Create( | 46 static void Create( |
| 46 content::WebContents* web_contents, | 47 content::WebContents* web_contents, |
| 47 PreviewsInfoBarType infobar_type, | 48 PreviewsInfoBarType infobar_type, |
| 49 bool is_data_saver_user, |
| 48 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 50 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 PreviewsInfoBarDelegate( | 53 PreviewsInfoBarDelegate( |
| 52 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
| 53 PreviewsInfoBarType infobar_type, | 55 PreviewsInfoBarType infobar_type, |
| 56 bool is_data_saver_user, |
| 54 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 57 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
| 55 | 58 |
| 56 // ConfirmInfoBarDelegate overrides: | 59 // ConfirmInfoBarDelegate overrides: |
| 57 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 60 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 58 int GetIconId() const override; | 61 int GetIconId() const override; |
| 59 bool ShouldExpire(const NavigationDetails& details) const override; | 62 bool ShouldExpire(const NavigationDetails& details) const override; |
| 60 void InfoBarDismissed() override; | 63 void InfoBarDismissed() override; |
| 61 base::string16 GetMessageText() const override; | 64 base::string16 GetMessageText() const override; |
| 62 int GetButtons() const override; | 65 int GetButtons() const override; |
| 63 base::string16 GetLinkText() const override; | 66 base::string16 GetLinkText() const override; |
| 64 bool LinkClicked(WindowOpenDisposition disposition) override; | 67 bool LinkClicked(WindowOpenDisposition disposition) override; |
| 65 | 68 |
| 66 PreviewsInfoBarType infobar_type_; | 69 PreviewsInfoBarType infobar_type_; |
| 67 | 70 |
| 71 const base::string16 message_text_; |
| 72 |
| 68 OnDismissPreviewsInfobarCallback on_dismiss_callback_; | 73 OnDismissPreviewsInfobarCallback on_dismiss_callback_; |
| 69 | 74 |
| 70 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 78 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |