Home | History | Annotate | Download | only in protocol
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_
      6 #define SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_
      7 
      8 // Keep this file in sync with the .proto files in this directory.
      9 
     10 #include "sync/base/sync_export.h"
     11 #include "sync/protocol/app_list_specifics.pb.h"
     12 #include "sync/protocol/client_debug_info.pb.h"
     13 #include "sync/protocol/session_specifics.pb.h"
     14 #include "sync/protocol/sync.pb.h"
     15 
     16 // Utility functions to get the string equivalent for some sync proto
     17 // enums.
     18 
     19 namespace syncer {
     20 
     21 // The returned strings (which don't have to be freed) are in ASCII.
     22 // The result of passing in an invalid enum value is undefined.
     23 
     24 SYNC_EXPORT_PRIVATE const char* GetAppListItemTypeString(
     25     sync_pb::AppListSpecifics::AppListItemType item_type);
     26 
     27 SYNC_EXPORT_PRIVATE const char* GetBrowserTypeString(
     28     sync_pb::SessionWindow::BrowserType browser_type);
     29 
     30 SYNC_EXPORT_PRIVATE const char* GetPageTransitionString(
     31     sync_pb::SyncEnums::PageTransition page_transition);
     32 
     33 SYNC_EXPORT_PRIVATE const char* GetPageTransitionRedirectTypeString(
     34     sync_pb::SyncEnums::PageTransitionRedirectType
     35         redirect_type);
     36 
     37 SYNC_EXPORT const char* GetUpdatesSourceString(
     38     sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source);
     39 
     40 SYNC_EXPORT const char* GetUpdatesOriginString(
     41     sync_pb::SyncEnums::GetUpdatesOrigin origin);
     42 
     43 SYNC_EXPORT_PRIVATE const char* GetResponseTypeString(
     44     sync_pb::CommitResponse::ResponseType response_type);
     45 
     46 SYNC_EXPORT_PRIVATE const char* GetErrorTypeString(
     47     sync_pb::SyncEnums::ErrorType error_type);
     48 
     49 SYNC_EXPORT_PRIVATE const char* GetActionString(
     50     sync_pb::SyncEnums::Action action);
     51 
     52 const char* GetDeviceTypeString(sync_pb::SyncEnums::DeviceType device_type);
     53 
     54 const char* GetFaviconTypeString(sync_pb::SessionTab::FaviconType favicon_type);
     55 
     56 const char* PassphraseTypeString(sync_pb::NigoriSpecifics::PassphraseType type);
     57 
     58 const char* SingletonEventTypeString(
     59     sync_pb::DebugEventInfo::SingletonEventType type);
     60 
     61 const char* GetBlockedStateString(sync_pb::TabNavigation::BlockedState state);
     62 
     63 }  // namespace syncer
     64 
     65 #endif  // SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_
     66