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