[iOS] Upstream iOS authentication constants
[chromium-blink-merge.git] / ios / chrome / browser / authentication / constants.h
blobc20c1f2d54e8eb3ceabdad36257ceec712589b3d
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_AUTHENTICATION_CONSTANTS_H_
6 #define IOS_CHROME_BROWSER_AUTHENTICATION_CONSTANTS_H_
8 #include <Foundation/Foundation.h>
10 namespace ios {
11 class ChromeBrowserState;
14 // Error domain for authentication error.
15 extern NSString* kAuthenticationErrorDomain;
17 // The key in the user info dictionary containing the GoogleServiceAuthError
18 // code.
19 extern NSString* kGoogleServiceAuthErrorState;
21 enum AuthenticationErrorCode {
22 // The error is wrapping a GoogleServiceAuthError.
23 kGoogleServiceAuthError = -200,
24 kNoAuthenticatedUser = -201,
25 kClientIdMissmatch = -203,
26 kClientSecretMissmatch = -204,
27 kUnexpectedSSOBehavior = -205,
28 kAuthenticationFlowError = -206,
29 kAccountReconcilorError = -207,
30 kTimedOutCheckPolicy = -208,
31 kTimedOutMergeSession = -209,
32 kTimedOutFetchPolicy = -210,
35 // Enum is used to count the various sign in sources in the histogram
36 // |Signin.IOSSignInSource|.
37 typedef enum {
38 // Unspecified sign-in source. This includes sign in operations started from
39 // "Other Devices" and from the sync error infobar displayed for pre-SSO
40 // signed in users.
41 SIGN_IN_SOURCE_OTHER,
42 // Sign in operation was started from first run.
43 SIGN_IN_SOURCE_FIRST_RUN,
44 // Sign in operation was started from the SSO recall promo.
45 SIGN_IN_SOURCE_SSO_PROMO,
46 // Sign in operation was started from settings.
47 SIGN_IN_SOURCE_SETTINGS,
48 // Sign in operation was started from as a pre-requisite of share operation.
49 SIGN_IN_SOURCE_SHARE,
50 // Sign in operation was started from as a pre-requisite of a print operation.
51 SIGN_IN_SOURCE_PRINT,
52 // Sign in operation was started from the re-sign in infobar.
53 SIGN_IN_SOURCE_RESIGN_IN_INFOBAR,
54 // Sign in operation was started from the Chrome to Device infobar.
55 SIGN_IN_SOURCE_CHROME_TO_DEVICE_INFOBAR,
56 // Sign in operation was started from the recent tabs panel.
57 SIGN_IN_SOURCE_RECENT_TABS,
58 // Sign in operation was started from the stars promo panel.
59 SIGN_IN_SOURCE_STARS_PROMO,
60 // NOTE: Add new sign in sources only immediately above this line. Also, make
61 // sure the enum list for histogram |Signin.IOSSignInSource| in
62 // tools/histogram/histograms.xml is updated with any change in here.
63 SIGN_IN_SOURCE_COUNT
64 } SignInSource;
66 typedef enum {
67 SHOULD_CLEAR_DATA_USER_CHOICE,
68 SHOULD_CLEAR_DATA_CLEAR_DATA,
69 SHOULD_CLEAR_DATA_MERGE_DATA,
70 } ShouldClearData;
72 // Enum is used to represent the action to be taken by the authentication once
73 // the user is successfully signed in.
74 typedef enum {
75 POST_SIGNIN_ACTION_NONE,
76 POST_SIGNIN_ACTION_START_SYNC,
77 } PostSignInAction;
79 namespace authentication_ui {
81 // Completion callback for a sign-in operation.
82 // |signedIn| is true if the operation was successful and the user is now
83 // signed in.
84 // |signedInBrowserState| is the browser state that was signed in.
85 typedef void (^CompletionCallback)(
86 BOOL signedIn,
87 ios::ChromeBrowserState* signedInBrowserState);
89 } // namespace authentication_ui
91 #endif // IOS_CHROME_BROWSER_AUTHENTICATION_CONSTANTS_H_