12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Keep this file in sync with the .proto files in this directory. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "sync/base/sync_export.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "sync/protocol/app_list_specifics.pb.h" 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "sync/protocol/app_specifics.pb.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "sync/protocol/client_debug_info.pb.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sync/protocol/session_specifics.pb.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sync/protocol/sync.pb.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Utility functions to get the string equivalent for some sync proto 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// enums. 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace syncer { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The returned strings (which don't have to be freed) are in ASCII. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The result of passing in an invalid enum value is undefined. 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetAppListItemTypeString( 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) sync_pb::AppListSpecifics::AppListItemType item_type); 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetBrowserTypeString( 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) sync_pb::SessionWindow::BrowserType browser_type); 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetPageTransitionString( 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) sync_pb::SyncEnums::PageTransition page_transition); 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetPageTransitionRedirectTypeString( 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) sync_pb::SyncEnums::PageTransitionRedirectType 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) redirect_type); 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT const char* GetUpdatesSourceString( 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source); 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)SYNC_EXPORT const char* GetUpdatesOriginString( 42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) sync_pb::SyncEnums::GetUpdatesOrigin origin); 43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetResponseTypeString( 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) sync_pb::CommitResponse::ResponseType response_type); 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetErrorTypeString( 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) sync_pb::SyncEnums::ErrorType error_type); 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetActionString( 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) sync_pb::SyncEnums::Action action); 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)SYNC_EXPORT_PRIVATE const char* GetLaunchTypeString( 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) sync_pb::AppSpecifics::LaunchType launch_type); 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const char* GetDeviceTypeString(sync_pb::SyncEnums::DeviceType device_type); 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 5990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const char* GetFaviconTypeString(sync_pb::SessionTab::FaviconType favicon_type); 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const char* PassphraseTypeString(sync_pb::NigoriSpecifics::PassphraseType type); 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)const char* SingletonDebugEventTypeString( 6423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) sync_pb::SyncEnums::SingletonDebugEventType type); 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 6690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const char* GetBlockedStateString(sync_pb::TabNavigation::BlockedState state); 6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace syncer 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_ 71