| // Copyright 2014 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_ |
| #define IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_ |
| |
| #import <Foundation/Foundation.h> |
| |
| #import "base/containers/enum_set.h" |
| |
| @class SceneState; |
| |
| typedef NS_ENUM(NSUInteger, SigninCoordinatorResult); |
| |
| // The key in the user info dictionary containing the GoogleServiceAuthError |
| // code. |
| extern NSString* const kGoogleServiceAuthErrorState; |
| |
| // Error domain for SystemIdentityManager errors. |
| extern NSString* const kSystemIdentityManagerErrorDomain; |
| |
| // Error code for `kSystemIdentityManagerErrorDomain`. |
| enum class SystemIdentityManagerErrorCode : NSInteger { |
| kNoAuthenticatedIdentity = 0, |
| kClientIDMismatch = 1, |
| kInvalidTokenIdentity = 2, |
| }; |
| |
| // Error domain for authentication error. |
| extern NSString* const kAuthenticationErrorDomain; |
| |
| // Error code for `kAuthenticationErrorDomain`. |
| typedef enum { |
| AUTHENTICATION_FLOW_ERROR = -206, |
| TIMED_OUT_FETCH_POLICY = -210, |
| } AuthenticationErrorCode; |
| |
| // Enum is used to represent the action to be taken by the authentication once |
| // the user is successfully signed in. |
| enum class PostSignInAction { |
| // Shows a snackbar displaying the account that just signed-in. |
| kShowSnackbar, |
| kFirstType = kShowSnackbar, |
| // Shows a snackbar to confirm the account that was just switched to. |
| kShowIdentityConfirmationSnackbar, |
| // Enables SelectableType::kBookmarks for the account that just signed-in from |
| // the bookmarks manager. |
| kEnableUserSelectableTypeBookmarks, |
| // Enables SelectableType::kReadingList for the account that just signed-in |
| // from the reading list manager. |
| kEnableUserSelectableTypeReadingList, |
| // Shows the history sync screen after a profile switch. |
| kShowHistorySyncScreenAfterProfileSwitch, |
| kLastType = kShowHistorySyncScreenAfterProfileSwitch |
| }; |
| |
| using PostSignInActionSet = base::EnumSet<PostSignInAction, |
| PostSignInAction::kFirstType, |
| PostSignInAction::kLastType>; |
| |
| // Enum for identity avatar size. See GetSizeForIdentityAvatarSize() to convert |
| // the enum value to point. |
| enum class IdentityAvatarSize { |
| TableViewIcon, // 30 pt. |
| SmallSize, // 32 pt. |
| Regular, // 40 pt. |
| Large, // 48 pt. |
| }; |
| |
| namespace signin_ui { |
| |
| // Completion callback for a sign-in operation. |
| // `success` is YES if the operation was successful. |
| using SigninCompletionCallback = void (^)(SigninCoordinatorResult success); |
| |
| // Completion callback for a sign-out operation. |
| // `success` is YES if the operation was successful. |
| using SignoutCompletionCallback = void (^)(BOOL success, |
| SceneState* scene_state); |
| |
| } // namespace signin_ui |
| |
| #endif // IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_ |