OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 REMOTING_HOST_HOST_EXIT_CODES_H_ | 5 #ifndef REMOTING_HOST_HOST_EXIT_CODES_H_ |
6 #define REMOTING_HOST_HOST_EXIT_CODES_H_ | 6 #define REMOTING_HOST_HOST_EXIT_CODES_H_ |
7 | 7 |
8 namespace remoting { | 8 namespace remoting { |
9 | 9 |
10 // Known host exit codes. The exit codes indicating permanent errors must be in | 10 // Known host exit codes. The exit codes indicating permanent errors must be in |
(...skipping 15 matching lines...) Expand all Loading... | |
26 kInvalidHostDomainExitCode = 103, | 26 kInvalidHostDomainExitCode = 103, |
27 kLoginScreenNotSupportedExitCode = 104, | 27 kLoginScreenNotSupportedExitCode = 104, |
28 kUsernameMismatchExitCode = 105, | 28 kUsernameMismatchExitCode = 105, |
29 | 29 |
30 // The range of the exit codes that should be interpreted as a permanent error | 30 // The range of the exit codes that should be interpreted as a permanent error |
31 // condition. | 31 // condition. |
32 kMinPermanentErrorExitCode = kInvalidHostConfigurationExitCode, | 32 kMinPermanentErrorExitCode = kInvalidHostConfigurationExitCode, |
33 kMaxPermanentErrorExitCode = kUsernameMismatchExitCode | 33 kMaxPermanentErrorExitCode = kUsernameMismatchExitCode |
34 }; | 34 }; |
35 | 35 |
36 const int PERMANENT_ERROR_EXIT_CODE_COUNT = | |
37 kMaxPermanentErrorExitCode - kMinPermanentErrorExitCode + 1; | |
38 | |
39 const std::string HostExitCodeStrings[] = { | |
rmsousa
2013/07/09 03:13:41
Nit: Please create a .cc file for the string defin
weitao
2013/07/09 19:02:17
Done.
| |
40 "INVALID_HOST_CONFIGURATION", | |
41 "INVALID_HOST_ID", | |
42 "INVALID_OAUTH_CREDENTIALS", | |
43 "INVALID_HOST_DOMAIN", | |
44 "LOGIN_SCREEN_NOT_SUPPORTED", | |
45 "USERNAME_MISMATCH" | |
46 }; | |
47 | |
48 inline std::string ExitCodeToString(int exit_code) { | |
rmsousa
2013/07/09 03:13:41
Nit: Please take a HostExitCode (rather than int)
weitao
2013/07/09 19:02:17
Done.
| |
49 DCHECK(exit_code >= kMinPermanentErrorExitCode && | |
rmsousa
2013/07/09 03:13:41
This will DCHECK for exit_code kSuccessExitCode (w
weitao
2013/07/09 19:02:17
Done.
| |
50 exit_code <= kMaxPermanentErrorExitCode); | |
51 | |
52 return HostExitCodeStrings[exit_code - kMinPermanentErrorExitCode]; | |
53 } | |
54 | |
36 } // namespace remoting | 55 } // namespace remoting |
37 | 56 |
38 #endif // REMOTING_HOST_HOST_EXIT_CODES_H_ | 57 #endif // REMOTING_HOST_HOST_EXIT_CODES_H_ |
OLD | NEW |