Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Unified Diff: sync/internal_api/public/base/model_type.h

Issue 10700180: [Sync] Add sync_export.h (Step 1 for componentizing sync) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/public/base/DEPS ('k') | sync/internal_api/public/base/model_type_payload_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/public/base/model_type.h
diff --git a/sync/internal_api/public/base/model_type.h b/sync/internal_api/public/base/model_type.h
index 25baf6c3f5260da50bf7c990ef2b7b7ab933b829..2c4613e9e62ea54e9df151cfd605d6a41701ab75 100644
--- a/sync/internal_api/public/base/model_type.h
+++ b/sync/internal_api/public/base/model_type.h
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/time.h"
+#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/enum_set.h"
namespace base {
@@ -29,6 +30,9 @@ class SyncEntity;
namespace syncer {
+// TODO(akalin): Move the non-exported functions in this file to a
+// private header.
+
enum ModelType {
// Object type unknown. Objects may transition through
// the unknown state during their initial creation, before
@@ -100,8 +104,9 @@ inline ModelType ModelTypeFromInt(int i) {
return static_cast<ModelType>(i);
}
-void AddDefaultFieldValue(ModelType datatype,
- sync_pb::EntitySpecifics* specifics);
+// Used by tests outside of sync/.
+SYNC_EXPORT void AddDefaultFieldValue(ModelType datatype,
+ sync_pb::EntitySpecifics* specifics);
// Extract the model type of a SyncEntity protocol buffer. ModelType is a
// local concept: the enum is not in the protocol. The SyncEntity's ModelType
@@ -112,7 +117,8 @@ ModelType GetModelType(const sync_pb::SyncEntity& sync_entity);
// Extract the model type from an EntitySpecifics field. Note that there
// are some ModelTypes (like TOP_LEVEL_FOLDER) that can't be inferred this way;
// prefer using GetModelType where possible.
-ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics);
+SYNC_EXPORT ModelType GetModelTypeFromSpecifics(
+ const sync_pb::EntitySpecifics& specifics);
// If this returns false, we shouldn't bother maintaining a position
// value (sibling ordering) for this item.
@@ -124,13 +130,16 @@ ModelType GetModelTypeFromSpecificsFieldNumber(int field_number);
// Return the field number of the EntitySpecifics field associated with
// a model type.
-int GetSpecificsFieldNumberFromModelType(ModelType model_type);
+//
+// Used by tests outside of sync.
+SYNC_EXPORT int GetSpecificsFieldNumberFromModelType(
+ ModelType model_type);
// TODO(sync): The functions below badly need some cleanup.
// Returns a pointer to a string with application lifetime that represents
// the name of |model_type|.
-const char* ModelTypeToString(ModelType model_type);
+SYNC_EXPORT const char* ModelTypeToString(ModelType model_type);
// Handles all model types, and not just real ones.
//
@@ -141,17 +150,18 @@ base::StringValue* ModelTypeToValue(ModelType model_type);
ModelType ModelTypeFromValue(const base::Value& value);
// Returns the ModelType corresponding to the name |model_type_string|.
-ModelType ModelTypeFromString(const std::string& model_type_string);
+SYNC_EXPORT ModelType ModelTypeFromString(
+ const std::string& model_type_string);
-std::string ModelTypeSetToString(ModelTypeSet model_types);
+SYNC_EXPORT std::string ModelTypeSetToString(ModelTypeSet model_types);
// Caller takes ownership of returned list.
-base::ListValue* ModelTypeSetToValue(ModelTypeSet model_types);
+SYNC_EXPORT base::ListValue* ModelTypeSetToValue(ModelTypeSet model_types);
-ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value);
+SYNC_EXPORT ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value);
// Returns a string corresponding to the syncable tag for this datatype.
-std::string ModelTypeToRootTag(ModelType type);
+SYNC_EXPORT std::string ModelTypeToRootTag(ModelType type);
// Convert a real model type to a notification type (used for
// subscribing to server-issued notifications). Returns true iff
@@ -167,7 +177,7 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
ModelType* model_type);
// Returns true if |model_type| is a real datatype
-bool IsRealDataType(ModelType model_type);
+SYNC_EXPORT bool IsRealDataType(ModelType model_type);
} // namespace syncer
« no previous file with comments | « sync/internal_api/public/base/DEPS ('k') | sync/internal_api/public/base/model_type_payload_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698