OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_COMMANDS_SHOW_SIGNIN_COMMAND_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_COMMANDS_SHOW_SIGNIN_COMMAND_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include "ios/chrome/browser/authentication/constants.h" |
| 11 #include "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 12 |
| 13 typedef void (^ShowSigninCommandCompletionCallback)(BOOL succeeded, |
| 14 BOOL profileWasSwapped); |
| 15 |
| 16 enum AuthenticationOperation { |
| 17 // Operation to cancel the current authentication operation and dismiss any |
| 18 // UI presented by this operation. |
| 19 AUTHENTICATION_OPERATION_DISMISS, |
| 20 |
| 21 // Operation to start a re-authenticate operation. The user is presented with |
| 22 // the SSOAuth re-authenticate web page. |
| 23 AUTHENTICATION_OPERATION_REAUTHENTICATE, |
| 24 |
| 25 // Operation to start a sign-in operation. The user is presented with the |
| 26 // SSOAuth sign in page (SSOAuth account picker or SSOAuth sign-in web page). |
| 27 AUTHENTICATION_OPERATION_SIGNIN, |
| 28 }; |
| 29 |
| 30 // A command to perform a sign in operation. |
| 31 @interface ShowSigninCommand : GenericChromeCommand |
| 32 |
| 33 // Mark inherited initializer as unavailable to prevent calling it by mistake. |
| 34 - (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE; |
| 35 |
| 36 // Initializes a command to perform the specified operation with a |
| 37 // SigninInteractionController and invoke a possibly-nil callback when finished. |
| 38 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
| 39 signInSource:(SignInSource)signInSource |
| 40 callback:(ShowSigninCommandCompletionCallback)callback |
| 41 NS_DESIGNATED_INITIALIZER; |
| 42 |
| 43 // Initializes a ShowSigninCommand with a nil callback. |
| 44 - (instancetype)initWithOperation:(AuthenticationOperation)operation |
| 45 signInSource:(SignInSource)signInSource; |
| 46 |
| 47 // The callback to be invoked after the operation is complete. |
| 48 @property(nonatomic, readonly) ShowSigninCommandCompletionCallback callback; |
| 49 |
| 50 // The operation to perform during the sign-in flow. |
| 51 @property(nonatomic, readonly) AuthenticationOperation operation; |
| 52 |
| 53 // The source of this authentication operation. |
| 54 @property(nonatomic, readonly) SignInSource signInSource; |
| 55 |
| 56 @end |
| 57 |
| 58 #endif // IOS_CHROME_BROWSER_UI_COMMANDS_SHOW_SIGNIN_COMMAND_H_ |
OLD | NEW |