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_SIGNIN_CONSTANTS_H_ | 5 #ifndef IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_ |
6 #define IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_ | 6 #define IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_ |
7 | 7 |
8 #include <Foundation/Foundation.h> | 8 #include <Foundation/Foundation.h> |
9 | 9 |
10 // Error domain for authentication error. | 10 // Error domain for authentication error. |
11 extern NSString* kAuthenticationErrorDomain; | 11 extern NSString* kAuthenticationErrorDomain; |
12 | 12 |
13 // The key in the user info dictionary containing the GoogleServiceAuthError | 13 // The key in the user info dictionary containing the GoogleServiceAuthError |
14 // code. | 14 // code. |
15 extern NSString* kGoogleServiceAuthErrorState; | 15 extern NSString* kGoogleServiceAuthErrorState; |
16 | 16 |
17 typedef enum { | 17 typedef enum { |
18 // The error is wrapping a GoogleServiceAuthError. | 18 // The error is wrapping a GoogleServiceAuthError. |
19 GOOGLE_SERVICE_AUTH_ERROR = -200, | 19 GOOGLE_SERVICE_AUTH_ERROR = -200, |
20 NO_AUTHENTICATED_USER = -201, | 20 NO_AUTHENTICATED_USER = -201, |
21 CLIENT_ID_MISMATCH = -203, | 21 CLIENT_ID_MISMATCH = -203, |
22 CLIENT_SECRET_MISMATCH = -204, | 22 CLIENT_SECRET_MISMATCH = -204, |
23 AUTHENTICATION_FLOW_ERROR = -206, | 23 AUTHENTICATION_FLOW_ERROR = -206, |
24 TIMED_OUT_FETCH_POLICY = -210, | 24 TIMED_OUT_FETCH_POLICY = -210, |
25 } AuthenticationErrorCode; | 25 } AuthenticationErrorCode; |
26 | 26 |
27 // Enum is used to count the various sign in sources in the histogram | |
28 // |Signin.IOSSignInSource|. | |
29 typedef enum { | |
30 // Unspecified sign-in source. This includes sign in operations started from | |
31 // "Other Devices" and from the sync error infobar displayed for pre-SSO | |
32 // signed in users. | |
33 SIGN_IN_SOURCE_OTHER, | |
34 // Sign in operation was started from first run. | |
35 SIGN_IN_SOURCE_FIRST_RUN, | |
36 // Sign in operation was started from the SSO recall promo. | |
37 SIGN_IN_SOURCE_SSO_PROMO, | |
38 // Sign in operation was started from settings. | |
39 SIGN_IN_SOURCE_SETTINGS, | |
40 // Sign in operation was started from as a pre-requisite of share operation. | |
41 // Deprecated since M53. | |
42 SIGN_IN_SOURCE_SHARE_DEPRECATED, | |
43 // Sign in operation was started from as a pre-requisite of a print operation. | |
44 SIGN_IN_SOURCE_PRINT, | |
45 // Sign in operation was started from the re-sign in infobar. | |
46 SIGN_IN_SOURCE_RESIGN_IN_INFOBAR, | |
47 // Sign in operation was started from the Chrome to Device infobar. | |
48 SIGN_IN_SOURCE_CHROME_TO_DEVICE_INFOBAR, | |
49 // Sign in operation was started from the recent tabs panel. | |
50 SIGN_IN_SOURCE_RECENT_TABS, | |
51 // Sign in operation was started from the bookmarks promo panel. | |
52 SIGN_IN_SOURCE_BOOKMARKS_PROMO, | |
53 // Sign in operation was started from the Tab Switcher. | |
54 SIGN_IN_SOURCE_TAB_SWITCHER, | |
55 // NOTE: Add new sign in sources only immediately above this line. Also, make | |
56 // sure the enum list for histogram |Signin.IOSSignInSource| in | |
57 // uma/configs/chrome/histograms.xml is updated with any change in here. | |
58 SIGN_IN_SOURCE_COUNT | |
59 } SignInSource; | |
60 | |
61 typedef enum { | 27 typedef enum { |
62 SHOULD_CLEAR_DATA_USER_CHOICE, | 28 SHOULD_CLEAR_DATA_USER_CHOICE, |
63 SHOULD_CLEAR_DATA_CLEAR_DATA, | 29 SHOULD_CLEAR_DATA_CLEAR_DATA, |
64 SHOULD_CLEAR_DATA_MERGE_DATA, | 30 SHOULD_CLEAR_DATA_MERGE_DATA, |
65 } ShouldClearData; | 31 } ShouldClearData; |
66 | 32 |
67 // Enum is used to represent the action to be taken by the authentication once | 33 // Enum is used to represent the action to be taken by the authentication once |
68 // the user is successfully signed in. | 34 // the user is successfully signed in. |
69 typedef enum { | 35 typedef enum { |
70 POST_SIGNIN_ACTION_NONE, | 36 POST_SIGNIN_ACTION_NONE, |
71 POST_SIGNIN_ACTION_START_SYNC, | 37 POST_SIGNIN_ACTION_START_SYNC, |
72 } PostSignInAction; | 38 } PostSignInAction; |
73 | 39 |
74 namespace signin_ui { | 40 namespace signin_ui { |
75 | 41 |
76 // Completion callback for a sign-in operation. | 42 // Completion callback for a sign-in operation. |
77 // |success| is YES if the operation was successful. | 43 // |success| is YES if the operation was successful. |
78 typedef void (^CompletionCallback)(BOOL success); | 44 typedef void (^CompletionCallback)(BOOL success); |
79 | 45 |
80 } // namespace signin_ui | 46 } // namespace signin_ui |
81 | 47 |
82 #endif // IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_ | 48 #endif // IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_ |
OLD | NEW |