Index: ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h |
diff --git a/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ac882d30b4dd0146909b5cd24f9e9a5876530e87 |
--- /dev/null |
+++ b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h |
@@ -0,0 +1,62 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |
+#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |
+ |
+#include <memory> |
+ |
+#include "base/strings/string16.h" |
+#include "components/infobars/core/confirm_infobar_delegate.h" |
+#include "components/infobars/core/infobar.h" |
+#include "ui/gfx/image/image.h" |
+ |
+namespace infobars { |
+class InfoBarManager; |
+} // namespace infobars |
+ |
+namespace ios { |
+class ChromeBrowserState; |
+} // namespace ios |
+ |
+@class Tab; |
+ |
+// A confirmation infobar prompting user to bring up the sign-in screen. |
+class ReSignInInfoBarDelegate : public ConfirmInfoBarDelegate { |
+ public: |
+ explicit ReSignInInfoBarDelegate(ios::ChromeBrowserState* browser_state); |
+ ~ReSignInInfoBarDelegate() override; |
+ |
+ // Creates a re-sign-in error infobar and adds it to the |tab|. Returns |
+ // whether the infobar was actually added. |
+ static bool Create(ios::ChromeBrowserState* browser_state, Tab* tab); |
+ |
+ // Creates a re-sign-in error infobar, but does not add it to tab content. |
+ static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
+ infobars::InfoBarManager* infobar_manager, |
+ ios::ChromeBrowserState* browser_state); |
+ |
+ // Creates a re-sign-in error infobar delegate, visible for testing. |
+ static std::unique_ptr<ReSignInInfoBarDelegate> CreateInfoBarDelegate( |
+ ios::ChromeBrowserState* browser_state); |
+ |
+ // InfobarDelegate implementation. |
+ InfoBarIdentifier GetIdentifier() const override; |
+ |
+ // ConfirmInfoBarDelegate implementation. |
+ base::string16 GetMessageText() const override; |
+ int GetButtons() const override; |
+ base::string16 GetButtonLabel(InfoBarButton button) const override; |
+ gfx::Image GetIcon() const override; |
+ bool Accept() override; |
+ void InfoBarDismissed() override; |
+ |
+ private: |
+ ios::ChromeBrowserState* browser_state_; |
+ gfx::Image icon_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ReSignInInfoBarDelegate); |
+}; |
+ |
+#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_RE_SIGNIN_INFOBAR_DELEGATE_H_ |