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.
5 #ifndef IOS_CHROME_BROWSER_UI_COMMANDS_SHOW_SIGNIN_COMMAND_H_
6 #define IOS_CHROME_BROWSER_UI_COMMANDS_SHOW_SIGNIN_COMMAND_H_
8 #import <Foundation/Foundation.h>
10 #include "ios/chrome/browser/signin/constants.h"
11 #include "ios/chrome/browser/ui/commands/generic_chrome_command.h"
13 typedef void (^ShowSigninCommandCompletionCallback
)(BOOL succeeded
,
14 BOOL profileWasSwapped
);
16 enum AuthenticationOperation
{
17 // Operation to cancel the current authentication operation and dismiss any
18 // UI presented by this operation.
19 AUTHENTICATION_OPERATION_DISMISS
,
21 // Operation to start a re-authenticate operation. The user is presented with
22 // the SSOAuth re-authenticate web page.
23 AUTHENTICATION_OPERATION_REAUTHENTICATE
,
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
,
30 // A command to perform a sign in operation.
31 @interface ShowSigninCommand
: GenericChromeCommand
33 // Mark inherited initializer as unavailable to prevent calling it by mistake.
34 - (instancetype
)initWithTag
:(NSInteger
)tag NS_UNAVAILABLE
;
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
;
43 // Initializes a ShowSigninCommand with a nil callback.
44 - (instancetype
)initWithOperation
:(AuthenticationOperation
)operation
45 signInSource
:(SignInSource
)signInSource
;
47 // The callback to be invoked after the operation is complete.
48 @
property(nonatomic
, readonly
) ShowSigninCommandCompletionCallback callback
;
50 // The operation to perform during the sign-in flow.
51 @
property(nonatomic
, readonly
) AuthenticationOperation operation
;
53 // The source of this authentication operation.
54 @
property(nonatomic
, readonly
) SignInSource signInSource
;
58 #endif // IOS_CHROME_BROWSER_UI_COMMANDS_SHOW_SIGNIN_COMMAND_H_