Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / signin / constants.h
blobd0932b857452e01d6b7d2c8a3ffe322b6388082d
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_SIGNIN_CONSTANTS_H_
6 #define IOS_CHROME_BROWSER_SIGNIN_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 typedef enum {
22 // The error is wrapping a GoogleServiceAuthError.
23 GOOGLE_SERVICE_AUTH_ERROR = -200,
24 NO_AUTHENTICATED_USER = -201,
25 CLIENT_ID_MISMATCH = -203,
26 CLIENT_SECRET_MISMATCH = -204,
27 AUTHENTICATION_FLOW_ERROR = -206,
28 TIMED_OUT_FETCH_POLICY = -210,
29 } AuthenticationErrorCode;
31 // Enum is used to count the various sign in sources in the histogram
32 // |Signin.IOSSignInSource|.
33 typedef enum {
34 // Unspecified sign-in source. This includes sign in operations started from
35 // "Other Devices" and from the sync error infobar displayed for pre-SSO
36 // signed in users.
37 SIGN_IN_SOURCE_OTHER,
38 // Sign in operation was started from first run.
39 SIGN_IN_SOURCE_FIRST_RUN,
40 // Sign in operation was started from the SSO recall promo.
41 SIGN_IN_SOURCE_SSO_PROMO,
42 // Sign in operation was started from settings.
43 SIGN_IN_SOURCE_SETTINGS,
44 // Sign in operation was started from as a pre-requisite of share operation.
45 SIGN_IN_SOURCE_SHARE,
46 // Sign in operation was started from as a pre-requisite of a print operation.
47 SIGN_IN_SOURCE_PRINT,
48 // Sign in operation was started from the re-sign in infobar.
49 SIGN_IN_SOURCE_RESIGN_IN_INFOBAR,
50 // Sign in operation was started from the Chrome to Device infobar.
51 SIGN_IN_SOURCE_CHROME_TO_DEVICE_INFOBAR,
52 // Sign in operation was started from the recent tabs panel.
53 SIGN_IN_SOURCE_RECENT_TABS,
54 // Sign in operation was started from the stars promo panel.
55 SIGN_IN_SOURCE_STARS_PROMO,
56 // NOTE: Add new sign in sources only immediately above this line. Also, make
57 // sure the enum list for histogram |Signin.IOSSignInSource| in
58 // tools/histogram/histograms.xml is updated with any change in here.
59 SIGN_IN_SOURCE_COUNT
60 } SignInSource;
62 typedef enum {
63 SHOULD_CLEAR_DATA_USER_CHOICE,
64 SHOULD_CLEAR_DATA_CLEAR_DATA,
65 SHOULD_CLEAR_DATA_MERGE_DATA,
66 } ShouldClearData;
68 // Enum is used to represent the action to be taken by the authentication once
69 // the user is successfully signed in.
70 typedef enum {
71 POST_SIGNIN_ACTION_NONE,
72 POST_SIGNIN_ACTION_START_SYNC,
73 } PostSignInAction;
75 namespace signin_ui {
77 // Completion callback for a sign-in operation.
78 // |signedIn| is true if the operation was successful and the user is now
79 // signed in.
80 // |signedInBrowserState| is the browser state that was signed in.
81 typedef void (^CompletionCallback)(
82 BOOL signedIn,
83 ios::ChromeBrowserState* signedInBrowserState);
85 } // namespace signin_ui
87 #endif // IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_