OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ | 5 #ifndef COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ |
6 #define COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ | 6 #define COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ |
7 | 7 |
8 // Keep this file in sync with the .proto files in this directory. | 8 // Keep this file in sync with the .proto files in this directory. |
9 | 9 |
10 #include "components/sync/protocol/app_list_specifics.pb.h" | 10 #include "components/sync/protocol/app_list_specifics.pb.h" |
11 #include "components/sync/protocol/app_specifics.pb.h" | 11 #include "components/sync/protocol/app_specifics.pb.h" |
12 #include "components/sync/protocol/client_debug_info.pb.h" | 12 #include "components/sync/protocol/client_debug_info.pb.h" |
13 #include "components/sync/protocol/reading_list_specifics.pb.h" | 13 #include "components/sync/protocol/reading_list_specifics.pb.h" |
14 #include "components/sync/protocol/session_specifics.pb.h" | 14 #include "components/sync/protocol/session_specifics.pb.h" |
15 #include "components/sync/protocol/sync.pb.h" | 15 #include "components/sync/protocol/sync.pb.h" |
16 | 16 |
17 // Utility functions to get the string equivalent for some sync proto | 17 // Utility functions to get the string equivalent for some sync proto |
18 // enums. | 18 // enums. |
19 | 19 |
20 namespace syncer { | 20 namespace syncer { |
21 | 21 |
22 // The returned strings (which don't have to be freed) are in ASCII. | 22 // The returned strings (which don't have to be freed) are in ASCII. |
23 // The result of passing in an invalid enum value is undefined. | 23 // The result of passing in an invalid enum value is undefined. |
24 | 24 |
25 const char* GetAppListItemTypeString( | 25 const char* ProtoEnumToString( |
26 sync_pb::AppListSpecifics::AppListItemType item_type); | 26 sync_pb::AppListSpecifics::AppListItemType item_type); |
27 | 27 |
28 const char* GetBrowserTypeString( | 28 const char* ProtoEnumToString( |
29 sync_pb::SessionWindow::BrowserType browser_type); | 29 sync_pb::SessionWindow::BrowserType browser_type); |
30 | 30 |
31 const char* GetPageTransitionString( | 31 const char* ProtoEnumToString( |
32 sync_pb::SyncEnums::PageTransition page_transition); | 32 sync_pb::SyncEnums::PageTransition page_transition); |
33 | 33 |
34 const char* GetPageTransitionRedirectTypeString( | 34 const char* ProtoEnumToString( |
35 sync_pb::SyncEnums::PageTransitionRedirectType redirect_type); | 35 sync_pb::SyncEnums::PageTransitionRedirectType redirect_type); |
36 | 36 |
37 const char* GetWifiCredentialSecurityClassString( | 37 const char* ProtoEnumToString( |
38 sync_pb::WifiCredentialSpecifics::SecurityClass security_class); | 38 sync_pb::WifiCredentialSpecifics::SecurityClass security_class); |
39 | 39 |
40 const char* GetUpdatesSourceString( | 40 const char* ProtoEnumToString( |
41 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source); | 41 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source); |
42 | 42 |
43 const char* GetUpdatesOriginString(sync_pb::SyncEnums::GetUpdatesOrigin origin); | 43 const char* ProtoEnumToString(sync_pb::SyncEnums::GetUpdatesOrigin origin); |
44 | 44 |
45 const char* GetReadingListEntryStatusString( | 45 const char* ProtoEnumToString( |
46 sync_pb::ReadingListSpecifics::ReadingListEntryStatus status); | 46 sync_pb::ReadingListSpecifics::ReadingListEntryStatus status); |
47 | 47 |
48 const char* GetResponseTypeString( | 48 const char* ProtoEnumToString( |
49 sync_pb::CommitResponse::ResponseType response_type); | 49 sync_pb::CommitResponse::ResponseType response_type); |
50 | 50 |
51 const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type); | 51 const char* ProtoEnumToString(sync_pb::SyncEnums::ErrorType error_type); |
52 | 52 |
53 const char* GetActionString(sync_pb::SyncEnums::Action action); | 53 const char* ProtoEnumToString(sync_pb::SyncEnums::Action action); |
54 | 54 |
55 const char* GetLaunchTypeString(sync_pb::AppSpecifics::LaunchType launch_type); | 55 const char* ProtoEnumToString(sync_pb::AppSpecifics::LaunchType launch_type); |
56 | 56 |
57 const char* GetWalletInfoTypeString( | 57 const char* ProtoEnumToString( |
58 sync_pb::AutofillWalletSpecifics::WalletInfoType wallet_info_type); | 58 sync_pb::AutofillWalletSpecifics::WalletInfoType wallet_info_type); |
59 | 59 |
60 const char* GetWalletMetadataTypeString( | 60 const char* ProtoEnumToString( |
61 sync_pb::WalletMetadataSpecifics::Type wallet_metadata_type); | 61 sync_pb::WalletMetadataSpecifics::Type wallet_metadata_type); |
62 | 62 |
63 const char* GetWalletCardStatusString( | 63 const char* ProtoEnumToString( |
64 sync_pb::WalletMaskedCreditCard::WalletCardStatus wallet_card_status); | 64 sync_pb::WalletMaskedCreditCard::WalletCardStatus wallet_card_status); |
65 | 65 |
66 const char* GetWalletCardTypeString( | 66 const char* ProtoEnumToString( |
67 sync_pb::WalletMaskedCreditCard::WalletCardType wallet_card_type); | 67 sync_pb::WalletMaskedCreditCard::WalletCardType wallet_card_type); |
68 | 68 |
69 const char* GetDeviceTypeString(sync_pb::SyncEnums::DeviceType device_type); | 69 const char* ProtoEnumToString(sync_pb::SyncEnums::DeviceType device_type); |
70 | 70 |
71 const char* GetFaviconTypeString(sync_pb::SessionTab::FaviconType favicon_type); | 71 const char* ProtoEnumToString(sync_pb::SessionTab::FaviconType favicon_type); |
72 | 72 |
73 const char* PassphraseTypeString(sync_pb::NigoriSpecifics::PassphraseType type); | 73 const char* ProtoEnumToString(sync_pb::NigoriSpecifics::PassphraseType type); |
74 | 74 |
75 const char* SingletonDebugEventTypeString( | 75 const char* ProtoEnumToString( |
76 sync_pb::SyncEnums::SingletonDebugEventType type); | 76 sync_pb::SyncEnums::SingletonDebugEventType type); |
77 | 77 |
78 const char* GetBlockedStateString(sync_pb::TabNavigation::BlockedState state); | 78 const char* ProtoEnumToString(sync_pb::TabNavigation::BlockedState state); |
79 const char* GetPasswordStateString(sync_pb::TabNavigation::PasswordState state); | 79 const char* ProtoEnumToString(sync_pb::TabNavigation::PasswordState state); |
80 | 80 |
81 } // namespace syncer | 81 } // namespace syncer |
82 | 82 |
83 #endif // COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ | 83 #endif // COMPONENTS_SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ |
OLD | NEW |