Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 ~PreviewsInfoBarDelegate() override; | 44 ~PreviewsInfoBarDelegate() override; |
| 45 | 45 |
| 46 // Creates a preview infobar and corresponding delegate and adds the infobar | 46 // Creates a preview infobar and corresponding delegate and adds the infobar |
| 47 // to InfoBarService. | 47 // to InfoBarService. |
| 48 static void Create( | 48 static void Create( |
| 49 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
| 50 PreviewsInfoBarType infobar_type, | 50 PreviewsInfoBarType infobar_type, |
| 51 bool is_data_saver_user, | 51 bool is_data_saver_user, |
| 52 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 52 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
| 53 | 53 |
| 54 // ConfirmInfoBarDelegate overrides: | |
| 55 base::string16 GetMessageText() const override; | |
| 56 base::string16 GetLinkText() const override; | |
| 57 | |
| 58 base::string16 GetTimestampText() const; | |
| 59 | |
| 54 private: | 60 private: |
| 55 PreviewsInfoBarDelegate( | 61 PreviewsInfoBarDelegate( |
| 56 content::WebContents* web_contents, | 62 content::WebContents* web_contents, |
| 57 PreviewsInfoBarType infobar_type, | 63 PreviewsInfoBarType infobar_type, |
| 58 bool is_data_saver_user, | 64 bool is_data_saver_user, |
| 59 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); | 65 const OnDismissPreviewsInfobarCallback& on_dismiss_callback); |
| 60 | 66 |
| 67 #if defined(OS_ANDROID) | |
| 68 // Returns a Previews infobar that owns |delegate|. | |
| 69 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( | |
|
RyanSturm
2017/05/08 20:48:17
Why is this declared here and defined in chrome/b
megjablon
2017/05/08 22:49:19
This is the pattern used by infobars and infobar d
| |
| 70 infobars::InfoBarManager* infobar_manager, | |
| 71 std::unique_ptr<PreviewsInfoBarDelegate> delegate); | |
| 72 #endif | |
| 73 | |
| 61 // ConfirmInfoBarDelegate overrides: | 74 // ConfirmInfoBarDelegate overrides: |
| 62 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 75 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 63 int GetIconId() const override; | 76 int GetIconId() const override; |
| 64 bool ShouldExpire(const NavigationDetails& details) const override; | 77 bool ShouldExpire(const NavigationDetails& details) const override; |
| 65 void InfoBarDismissed() override; | 78 void InfoBarDismissed() override; |
| 66 base::string16 GetMessageText() const override; | |
| 67 int GetButtons() const override; | 79 int GetButtons() const override; |
| 68 base::string16 GetLinkText() const override; | |
| 69 bool LinkClicked(WindowOpenDisposition disposition) override; | 80 bool LinkClicked(WindowOpenDisposition disposition) override; |
| 70 | 81 |
| 71 PreviewsInfoBarType infobar_type_; | 82 PreviewsInfoBarType infobar_type_; |
| 72 mutable PreviewsInfoBarAction infobar_dismissed_action_; | 83 mutable PreviewsInfoBarAction infobar_dismissed_action_; |
| 73 | 84 |
| 74 const base::string16 message_text_; | 85 const base::string16 message_text_; |
| 75 | 86 |
| 76 OnDismissPreviewsInfobarCallback on_dismiss_callback_; | 87 OnDismissPreviewsInfobarCallback on_dismiss_callback_; |
| 77 | 88 |
| 78 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); | 89 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); |
| 79 }; | 90 }; |
| 80 | 91 |
| 81 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 92 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |