OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/strings/string16.h" |
| 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 12 #include "components/infobars/core/infobar.h" |
| 13 #include "ui/gfx/image/image.h" |
| 14 |
| 15 namespace infobars { |
| 16 class InfoBarManager; |
| 17 } // namespace infobars |
| 18 |
| 19 namespace ios { |
| 20 class ChromeBrowserState; |
| 21 } // namespace ios |
| 22 |
| 23 @class Tab; |
| 24 |
| 25 // A confirmation infobar prompting user to bring up the sign-in screen. |
| 26 class ReSignInInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 27 public: |
| 28 explicit ReSignInInfoBarDelegate(ios::ChromeBrowserState* browser_state); |
| 29 ~ReSignInInfoBarDelegate() override; |
| 30 |
| 31 // Creates a re-sign-in error infobar and adds it to the |tab|. Returns |
| 32 // whether the infobar was actually added. |
| 33 static bool Create(ios::ChromeBrowserState* browser_state, Tab* tab); |
| 34 |
| 35 // Creates a re-sign-in error infobar, but does not add it to tab content. |
| 36 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
| 37 infobars::InfoBarManager* infobar_manager, |
| 38 ios::ChromeBrowserState* browser_state); |
| 39 |
| 40 // Creates a re-sign-in error infobar delegate, visible for testing. |
| 41 static std::unique_ptr<ReSignInInfoBarDelegate> CreateInfoBarDelegate( |
| 42 ios::ChromeBrowserState* browser_state); |
| 43 |
| 44 // InfobarDelegate implementation. |
| 45 InfoBarIdentifier GetIdentifier() const override; |
| 46 |
| 47 // ConfirmInfoBarDelegate implementation. |
| 48 base::string16 GetMessageText() const override; |
| 49 int GetButtons() const override; |
| 50 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 51 gfx::Image GetIcon() const override; |
| 52 bool Accept() override; |
| 53 void InfoBarDismissed() override; |
| 54 |
| 55 private: |
| 56 ios::ChromeBrowserState* browser_state_; |
| 57 gfx::Image icon_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ReSignInInfoBarDelegate); |
| 60 }; |
| 61 |
| 62 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |
OLD | NEW |