OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "blimp/client/public/resources/blimp_strings.h" | |
6 | |
7 #include "blimp/client/core/resources/grit/blimp_strings.h" | |
8 #include "blimp/common/proto/protocol_control.pb.h" | |
9 #include "ui/base/l10n/l10n_util.h" | |
10 | |
11 namespace blimp { | |
12 namespace string { | |
13 | |
14 base::string16 AssignmentResultErrorToString( | |
15 client::AssignmentRequestResult result) { | |
16 DCHECK(result != client::ASSIGNMENT_REQUEST_RESULT_OK); | |
17 | |
18 int string_id = IDS_ASSIGNMENT_SUCCESS; | |
19 switch (result) { | |
20 case client::ASSIGNMENT_REQUEST_RESULT_BAD_REQUEST: | |
21 string_id = IDS_ASSIGNMENT_FAILURE_BAD_REQUEST; | |
22 break; | |
23 case client::ASSIGNMENT_REQUEST_RESULT_BAD_RESPONSE: | |
24 string_id = IDS_ASSIGNMENT_FAILURE_BAD_RESPONSE; | |
25 break; | |
26 case client::ASSIGNMENT_REQUEST_RESULT_INVALID_PROTOCOL_VERSION: | |
27 string_id = IDS_ASSIGNMENT_FAILURE_BAD_VERSION; | |
28 break; | |
29 case client::ASSIGNMENT_REQUEST_RESULT_EXPIRED_ACCESS_TOKEN: | |
30 string_id = IDS_ASSIGNMENT_FAILURE_EXPIRED_TOKEN; | |
31 break; | |
32 case client::ASSIGNMENT_REQUEST_RESULT_USER_INVALID: | |
33 string_id = IDS_ASSIGNMENT_FAILURE_USER_INVALID; | |
34 break; | |
35 case client::ASSIGNMENT_REQUEST_RESULT_OUT_OF_VMS: | |
36 string_id = IDS_ASSIGNMENT_FAILURE_OUT_OF_VMS; | |
37 break; | |
38 case client::ASSIGNMENT_REQUEST_RESULT_SERVER_ERROR: | |
39 string_id = IDS_ASSIGNMENT_FAILURE_SERVER_ERROR; | |
40 break; | |
41 case client::ASSIGNMENT_REQUEST_RESULT_SERVER_INTERRUPTED: | |
42 string_id = IDS_ASSIGNMENT_FAILURE_SERVER_INTERRUPTED; | |
43 break; | |
44 case client::ASSIGNMENT_REQUEST_RESULT_NETWORK_FAILURE: | |
45 string_id = IDS_ASSIGNMENT_FAILURE_NETWORK; | |
46 break; | |
47 case client::ASSIGNMENT_REQUEST_RESULT_INVALID_CERT: | |
48 string_id = IDS_ASSIGNMENT_INVALID_CERT; | |
49 break; | |
50 case client::ASSIGNMENT_REQUEST_RESULT_UNKNOWN: | |
51 string_id = IDS_ASSIGNMENT_FAILURE_UNKNOWN; | |
52 break; | |
53 case client::ASSIGNMENT_REQUEST_RESULT_OK: | |
54 NOTIMPLEMENTED(); | |
55 } | |
56 | |
57 return l10n_util::GetStringUTF16(string_id); | |
58 } | |
59 | |
60 base::string16 EndConnectionMessageToString(int reason) { | |
61 int string_id = IDS_BLIMP_ENDCONNECTION_UNKNOWN; | |
62 EndConnectionMessage::Reason end_connection_reason = | |
63 static_cast<EndConnectionMessage::Reason>(reason); | |
64 switch (end_connection_reason) { | |
65 case EndConnectionMessage::AUTHENTICATION_FAILED: | |
66 string_id = IDS_BLIMP_ENDCONNECTION_AUTH_FAIL; | |
67 break; | |
68 case EndConnectionMessage::PROTOCOL_MISMATCH: | |
69 string_id = IDS_BLIMP_ENDCONNECTION_PROTOCOL_MISMATCH; | |
70 break; | |
71 case EndConnectionMessage::UNKNOWN: | |
72 string_id = IDS_BLIMP_ENDCONNECTION_UNKNOWN; | |
73 break; | |
74 } | |
75 | |
76 return l10n_util::GetStringUTF16(string_id); | |
77 } | |
78 | |
79 } // namespace string | |
80 } // namespace blimp | |
OLD | NEW |