OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ | 5 #ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ |
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ | 6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 @class NSError; | 10 @class NSError; |
(...skipping 13 matching lines...) Expand all Loading... |
24 NETWORK_ERROR, // Should be treated as transient/offline errors. | 24 NETWORK_ERROR, // Should be treated as transient/offline errors. |
25 USER_CANCELLATION_ERROR // Should be treated as a no-op. | 25 USER_CANCELLATION_ERROR // Should be treated as a no-op. |
26 }; | 26 }; |
27 | 27 |
28 enum class SigninError { | 28 enum class SigninError { |
29 CANCELED, // Operation canceled. | 29 CANCELED, // Operation canceled. |
30 MISSING_IDENTITY, // Request is missing identity. | 30 MISSING_IDENTITY, // Request is missing identity. |
31 HANDLED_INTERNALLY // Has been displayed to the user already. | 31 HANDLED_INTERNALLY // Has been displayed to the user already. |
32 }; | 32 }; |
33 | 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. | 34 // Provides utility methods and constants for interpreting signin errors. |
39 class SigninErrorProvider { | 35 class SigninErrorProvider { |
40 public: | 36 public: |
41 SigninErrorProvider(); | 37 SigninErrorProvider(); |
42 virtual ~SigninErrorProvider(); | 38 virtual ~SigninErrorProvider(); |
43 | 39 |
44 // Returns what family an error belongs to. | 40 // Returns what family an error belongs to. |
45 virtual SigninErrorCategory GetErrorCategory(NSError* error); | 41 virtual SigninErrorCategory GetErrorCategory(NSError* error); |
46 | 42 |
47 // Tests if an NSError is user cancellation error. | 43 // Tests if an NSError is user cancellation error. |
(...skipping 15 matching lines...) Expand all Loading... |
63 // Gets the error code corresponding to |error|. | 59 // Gets the error code corresponding to |error|. |
64 virtual int GetCode(SigninError error); | 60 virtual int GetCode(SigninError error); |
65 | 61 |
66 private: | 62 private: |
67 DISALLOW_COPY_AND_ASSIGN(SigninErrorProvider); | 63 DISALLOW_COPY_AND_ASSIGN(SigninErrorProvider); |
68 }; | 64 }; |
69 | 65 |
70 } // namespace ios | 66 } // namespace ios |
71 | 67 |
72 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ | 68 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_SIGNIN_ERROR_PROVIDER_H_ |
OLD | NEW |