1 // Copyright 2013 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 #include "remoting/host/host_exit_codes.h"
6
7 #include "remoting/base/name_value_map.h"
8
9 namespace remoting {
10
11 const NameMapElement<HostExitCodes> kHostExitCodeStrings[] = {
12 {kSuccessExitCode, "SUCCESS_EXIT"},
13 {kInitializationFailed, "INITIALIZATION_FAILED"},
14 {kInvalidCommandLineExitCode, "INVALID_COMMAND_LINE"},
15 {kNoPermissionExitCode, "NO_PERMISSION"},
16 {kInvalidHostConfigurationExitCode, "INVALID_HOST_CONFIGURATION"},
17 {kInvalidHostIdExitCode, "INVALID_HOST_ID"},
18 {kInvalidOauthCredentialsExitCode, "INVALID_OAUTH_CREDENTIALS"},
19 {kInvalidHostDomainExitCode, "INVALID_HOST_DOMAIN"},
20 {kLoginScreenNotSupportedExitCode, "LOGIN_SCREEN_NOT_SUPPORTED"},
21 {kUsernameMismatchExitCode, "USERNAME_MISMATCH"},
22 {kHostDeletedExitCode, "HOST_DELETED"},
23 };
24
ExitCodeToString(HostExitCodes exit_code)25 const char* ExitCodeToString(HostExitCodes exit_code) {
26 return ValueToName(kHostExitCodeStrings, exit_code);
27 }
28
ExitCodeToStringUnchecked(int exit_code)29 const char* ExitCodeToStringUnchecked(int exit_code) {
30 return ValueToNameUnchecked(kHostExitCodeStrings,
31 static_cast<HostExitCodes>(exit_code));
32 }
33
34 } // namespace remoting
35