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 #include "sync/internal_api/public/util/sync_string_conversions.h" | 5 #include "components/sync/base/sync_string_conversions.h" |
6 | 6 |
7 #define ENUM_CASE(x) case x: return #x | 7 #define ENUM_CASE(x) \ |
| 8 case x: \ |
| 9 return #x |
8 | 10 |
9 namespace syncer { | 11 namespace syncer { |
10 | 12 |
11 const char* ConnectionStatusToString(ConnectionStatus status) { | 13 const char* ConnectionStatusToString(ConnectionStatus status) { |
12 switch (status) { | 14 switch (status) { |
13 ENUM_CASE(CONNECTION_OK); | 15 ENUM_CASE(CONNECTION_OK); |
14 ENUM_CASE(CONNECTION_AUTH_ERROR); | 16 ENUM_CASE(CONNECTION_AUTH_ERROR); |
15 ENUM_CASE(CONNECTION_SERVER_ERROR); | 17 ENUM_CASE(CONNECTION_SERVER_ERROR); |
16 default: | 18 default: |
17 NOTREACHED(); | 19 NOTREACHED(); |
18 return "INVALID_CONNECTION_STATUS"; | 20 return "INVALID_CONNECTION_STATUS"; |
19 } | 21 } |
20 } | 22 } |
21 | 23 |
22 // Helper function that converts a PassphraseRequiredReason value to a string. | 24 // Helper function that converts a PassphraseRequiredReason value to a string. |
23 const char* PassphraseRequiredReasonToString( | 25 const char* PassphraseRequiredReasonToString(PassphraseRequiredReason reason) { |
24 PassphraseRequiredReason reason) { | |
25 switch (reason) { | 26 switch (reason) { |
26 ENUM_CASE(REASON_PASSPHRASE_NOT_REQUIRED); | 27 ENUM_CASE(REASON_PASSPHRASE_NOT_REQUIRED); |
27 ENUM_CASE(REASON_ENCRYPTION); | 28 ENUM_CASE(REASON_ENCRYPTION); |
28 ENUM_CASE(REASON_DECRYPTION); | 29 ENUM_CASE(REASON_DECRYPTION); |
29 default: | 30 default: |
30 NOTREACHED(); | 31 NOTREACHED(); |
31 return "INVALID_REASON"; | 32 return "INVALID_REASON"; |
32 } | 33 } |
33 } | 34 } |
34 | 35 |
(...skipping 13 matching lines...) Expand all Loading... |
48 switch (type) { | 49 switch (type) { |
49 ENUM_CASE(PASSPHRASE_BOOTSTRAP_TOKEN); | 50 ENUM_CASE(PASSPHRASE_BOOTSTRAP_TOKEN); |
50 ENUM_CASE(KEYSTORE_BOOTSTRAP_TOKEN); | 51 ENUM_CASE(KEYSTORE_BOOTSTRAP_TOKEN); |
51 default: | 52 default: |
52 NOTREACHED(); | 53 NOTREACHED(); |
53 return "INVALID_BOOTSTRAP_TOKEN_TYPE"; | 54 return "INVALID_BOOTSTRAP_TOKEN_TYPE"; |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 } // namespace syncer | 58 } // namespace syncer |
OLD | NEW |