Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ios/public/provider/chrome/browser/signin/signin_error_provider.h

Issue 1252323006: [iOS] Upstream //ios/chrome/browser/signin/signin_util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add SigninErrorProvider Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_
7
8 #include "base/macros.h"
9
10 @class NSError;
11 @class NSString;
12
13 namespace ios {
14
15 class SigninErrorProvider;
16
17 // Signin error categories.
18 // Can be used to figure out whether the error is because the user has their
19 // credentials revoked, deleted or disabled so the appropriate action can be
20 // taken.
21 enum class SigninErrorCategory {
22 UNKNOWN_ERROR,
23 AUTHORIZATION_ERROR, // Should be handled by signing out the user.
24 NETWORK_ERROR, // Should be treated as transient/offline errors.
25 USER_CANCELLATION_ERROR // Should be treated as a no-op.
26 };
27
28 enum class SigninError {
29 CANCELED, // Operation canceled.
30 MISSING_IDENTITY, // Request is missing identity.
31 HANDLED_INTERNALLY // Has been displayed to the user already.
32 };
33
34 // Registers and returns the global SigninErrorProvider.
35 void SetSigninErrorProvider(SigninErrorProvider* provider);
36 SigninErrorProvider* GetSigninErrorProvider();
37
38 // Provides utility methods and constants for interpreting signin errors.
39 class SigninErrorProvider {
40 public:
41 SigninErrorProvider();
42 virtual ~SigninErrorProvider();
43
44 // Returns what family an error belongs to.
45 virtual SigninErrorCategory GetErrorCategory(NSError* error);
46
47 // Tests if an NSError is user cancellation error.
48 virtual bool IsCanceled(NSError* error);
49
50 // Constant in JSON error responses to server requests indicating that
51 // the authentication was revoked by the server.
52 virtual NSString* GetInvalidGrantJsonErrorKey();
53
54 // Gets the signin error domain.
55 virtual NSString* GetSigninErrorDomain();
56
57 // Gets the error code corresponding to |error|.
58 virtual int GetCode(SigninError error);
59
60 private:
61 DISALLOW_COPY_AND_ASSIGN(SigninErrorProvider);
62 };
63
64 } // namespace ios
65
66 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_
OLDNEW
« no previous file with comments | « ios/provider/ios_provider_chrome.gyp ('k') | ios/public/provider/chrome/browser/signin/signin_error_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698