summaryrefslogtreecommitdiffstats
path: root/sync/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'sync/protocol')
-rw-r--r--sync/protocol/proto_value_conversions.cc15
-rw-r--r--sync/protocol/proto_value_conversions_unittest.cc4
-rw-r--r--sync/protocol/sync.proto17
3 files changed, 31 insertions, 5 deletions
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index e5528b92..79deafa 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -71,7 +71,10 @@ ListValue* MakeRepeatedValue(const F& fields, V* (*converter_fn)(T)) {
// Helper macros to reduce the amount of boilerplate.
-#define SET(field, fn) value->Set(#field, fn(proto.field()))
+#define SET(field, fn) \
+ if (proto.has_##field()) { \
+ value->Set(#field, fn(proto.field())); \
+ }
#define SET_REP(field, fn) \
value->Set(#field, MakeRepeatedValue(proto.field(), fn))
#define SET_ENUM(field, fn) \
@@ -166,7 +169,7 @@ DictionaryValue* TabNavigationToValue(
SET_INT32(unique_id);
SET_INT64(timestamp);
SET_BOOL(navigation_forward_back);
- SET_BOOL(navigation_from_address_bar),
+ SET_BOOL(navigation_from_address_bar);
SET_BOOL(navigation_home_page);
SET_BOOL(navigation_chain_start);
SET_BOOL(navigation_chain_end);
@@ -503,6 +506,13 @@ DictionaryValue* GetUpdatesMessageToValue(
return value;
}
+DictionaryValue* ClientStatusToValue(
+ const sync_pb::ClientStatus& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_BOOL(hierarchy_conflict_detected);
+ return value;
+}
+
DictionaryValue* EntryResponseToValue(
const sync_pb::CommitResponse::EntryResponse& proto) {
DictionaryValue* value = new DictionaryValue();
@@ -589,6 +599,7 @@ DictionaryValue* ClientToServerMessageToValue(
SET(get_updates, GetUpdatesMessageToValue);
SET_STR(store_birthday);
SET_BOOL(sync_problem_detected);
+ SET(client_status, ClientStatusToValue);
return value;
}
diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc
index d927d2d..c98023c 100644
--- a/sync/protocol/proto_value_conversions_unittest.cc
+++ b/sync/protocol/proto_value_conversions_unittest.cc
@@ -40,9 +40,7 @@ class ProtoValueConversionsTest : public testing::Test {
DictionaryValue* (*specifics_to_value)(const T&)) {
const T& specifics(T::default_instance());
scoped_ptr<DictionaryValue> value(specifics_to_value(specifics));
- // We can't do much but make sure that the returned value has
- // something in it.
- EXPECT_FALSE(value->empty());
+ // We can't do much but make sure that this doesn't crash.
}
};
diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto
index a0ee10b..ed4871b 100644
--- a/sync/protocol/sync.proto
+++ b/sync/protocol/sync.proto
@@ -469,6 +469,18 @@ message AuthenticateMessage {
message ChipBag {
};
+// Information about the syncer's state.
+message ClientStatus {
+ // Flag to indicate if the client has detected hierarchy conflcits. The flag
+ // is left unset if update application has not been attempted yet.
+ //
+ // The server should attempt to resolve any hierarchy conflicts when this flag
+ // is set. The client may not assume that any particular action will be
+ // taken. There is no guarantee the problem will be addressed in a reasonable
+ // amount of time.
+ optional bool hierarchy_conflict_detected = 1;
+}
+
message ClientToServerMessage {
required string share = 1;
optional int32 protocol_version = 2 [default = 31];
@@ -504,6 +516,11 @@ message ClientToServerMessage {
// Google API key.
optional string api_key = 12;
+
+ // Client's self-reported state.
+ // The client should set this on every message sent to the server, though its
+ // member fields may often be unset.
+ optional ClientStatus client_status = 13;
};
message CommitResponse {