summaryrefslogtreecommitdiffstats
path: root/sync/protocol
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 08:21:05 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 08:21:05 +0000
commit35296fe1812b50829b1efea29aa70d6d300f20f7 (patch)
treeb0db9f4604c903776191ea14ecb9da0ee6b883d3 /sync/protocol
parent74f566176e7b4b31c690ca039d1045d964dd9205 (diff)
downloadchromium_src-35296fe1812b50829b1efea29aa70d6d300f20f7.zip
chromium_src-35296fe1812b50829b1efea29aa70d6d300f20f7.tar.gz
chromium_src-35296fe1812b50829b1efea29aa70d6d300f20f7.tar.bz2
[Sync] Add history delete directive type
Add new HISTORY_DELETE_DIRECTIVE model type. Update everything that depends on model type. Rename SyncCryptographer test to Cryptographer (since it's already in sync_unit_tests). Add EncryptableUserTypes() function and use that instead of UserTypes() for encryption-related stuff. BUG=141245 TBR=jam@chromium.org Review URL: https://chromiumcodereview.appspot.com/10855037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/protocol')
-rw-r--r--sync/protocol/history_delete_directive_specifics.proto42
-rw-r--r--sync/protocol/nigori_specifics.proto2
-rw-r--r--sync/protocol/proto_value_conversions.cc25
-rw-r--r--sync/protocol/proto_value_conversions.h21
-rw-r--r--sync/protocol/proto_value_conversions_unittest.cc7
-rw-r--r--sync/protocol/sync.proto2
-rw-r--r--sync/protocol/sync_proto.gyp1
7 files changed, 99 insertions, 1 deletions
diff --git a/sync/protocol/history_delete_directive_specifics.proto b/sync/protocol/history_delete_directive_specifics.proto
new file mode 100644
index 0000000..557de8d
--- /dev/null
+++ b/sync/protocol/history_delete_directive_specifics.proto
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Sync protocol datatype extension for history delete directives.
+
+// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
+// any fields in this file.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+option retain_unknown_fields = true;
+
+package sync_pb;
+
+// All timestamps below are from Sane Time (
+// http://www.chromium.org/developers/design-documents/sane-time )
+// and are in microseconds since the Unix epoch.
+
+// Properties of history delete directive sync objects.
+message HistoryDeleteDirectiveSpecifics {
+ // Exactly one of the fields below must be filled in. Otherwise, this
+ // delete directive must be ignored.
+ optional GlobalIdDirective global_id_directive = 1;
+ optional TimeRangeDirective time_range_directive = 2;
+}
+
+message GlobalIdDirective {
+ // The global IDs of the navigations to delete.
+ repeated int64 global_id = 1;
+}
+
+message TimeRangeDirective {
+ // Both fields below must be filled in. Otherwise, this delete directive
+ // must be ignored.
+
+ // The time on or after which entries must be deleted.
+ optional int64 start_time_usec = 1;
+ // The time on or before which entries must be deleted.
+ optional int64 end_time_usec = 2;
+}
diff --git a/sync/protocol/nigori_specifics.proto b/sync/protocol/nigori_specifics.proto
index 6b3b066..c904783 100644
--- a/sync/protocol/nigori_specifics.proto
+++ b/sync/protocol/nigori_specifics.proto
@@ -51,6 +51,8 @@ message NigoriSpecifics {
// Booleans corresponding to whether a datatype should be encrypted.
// Passwords are always encrypted, so we don't need a field here.
+ // History delete directives need to be consumable by the server, and
+ // thus can't be encrypted.
optional bool encrypt_bookmarks = 13;
optional bool encrypt_preferences = 14;
optional bool encrypt_autofill_profile = 15;
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index 79deafa..9408346 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -19,6 +19,7 @@
#include "sync/protocol/encryption.pb.h"
#include "sync/protocol/extension_setting_specifics.pb.h"
#include "sync/protocol/extension_specifics.pb.h"
+#include "sync/protocol/history_delete_directive_specifics.pb.h"
#include "sync/protocol/nigori_specifics.pb.h"
#include "sync/protocol/password_specifics.pb.h"
#include "sync/protocol/preference_specifics.pb.h"
@@ -206,6 +207,21 @@ DictionaryValue* DeviceInfoSpecificsToValue(
return value;
}
+base::DictionaryValue* GlobalIdDirectiveToValue(
+ const sync_pb::GlobalIdDirective& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_INT64_REP(global_id);
+ return value;
+}
+
+base::DictionaryValue* TimeRangeDirectiveToValue(
+ const sync_pb::TimeRangeDirective& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_INT64(start_time_usec);
+ SET_INT64(end_time_usec);
+ return value;
+}
+
DictionaryValue* AppNotificationToValue(
const sync_pb::AppNotification& proto) {
DictionaryValue* value = new DictionaryValue();
@@ -301,6 +317,14 @@ DictionaryValue* ExtensionSpecificsToValue(
return value;
}
+base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
+ const sync_pb::HistoryDeleteDirectiveSpecifics& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET(global_id_directive, GlobalIdDirectiveToValue);
+ SET(time_range_directive, TimeRangeDirectiveToValue);
+ return value;
+}
+
DictionaryValue* NigoriSpecificsToValue(
const sync_pb::NigoriSpecifics& proto) {
DictionaryValue* value = new DictionaryValue();
@@ -408,6 +432,7 @@ DictionaryValue* EntitySpecificsToValue(
SET_FIELD(device_info, DeviceInfoSpecificsToValue);
SET_FIELD(extension, ExtensionSpecificsToValue);
SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue);
+ SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue);
SET_FIELD(nigori, NigoriSpecificsToValue);
SET_FIELD(password, PasswordSpecificsToValue);
SET_FIELD(preference, PreferenceSpecificsToValue);
diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h
index 597b767..fac364e 100644
--- a/sync/protocol/proto_value_conversions.h
+++ b/sync/protocol/proto_value_conversions.h
@@ -25,8 +25,11 @@ class DeviceInfoSpecifics;
class DeviceInformation;
class EncryptedData;
class EntitySpecifics;
+class EverythingDirective;
class ExtensionSettingSpecifics;
class ExtensionSpecifics;
+class GlobalIdDirective;
+class HistoryDeleteDirectiveSpecifics;
class NigoriSpecifics;
class PasswordSpecifics;
class PasswordSpecificsData;
@@ -38,6 +41,7 @@ class SessionTab;
class SessionWindow;
class TabNavigation;
class ThemeSpecifics;
+class TimeRangeDirective;
class TypedUrlSpecifics;
} // namespace sync_pb
@@ -82,6 +86,19 @@ base::DictionaryValue* TabNavigationToValue(
base::DictionaryValue* PasswordSpecificsDataToValue(
const sync_pb::PasswordSpecificsData& password_specifics_data);
+// Sub-protocol of NigoriSpecifics.
+
+base::DictionaryValue* DeviceInformationToValue(
+ const sync_pb::DeviceInformation& device_information);
+
+// Sub-protocol of HistoryDeleteDirectiveSpecifics.
+
+base::DictionaryValue* GlobalIdDirectiveToValue(
+ const sync_pb::GlobalIdDirective& global_id_directive);
+
+base::DictionaryValue* TimeRangeDirectiveToValue(
+ const sync_pb::TimeRangeDirective& time_range_directive);
+
// Main *SpecificsToValue functions.
base::DictionaryValue* AppNotificationToValue(
@@ -108,6 +125,10 @@ base::DictionaryValue* ExtensionSettingSpecificsToValue(
base::DictionaryValue* ExtensionSpecificsToValue(
const sync_pb::ExtensionSpecifics& extension_specifics);
+base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
+ const sync_pb::HistoryDeleteDirectiveSpecifics&
+ history_delete_directive_specifics);
+
base::DictionaryValue* NigoriSpecificsToValue(
const sync_pb::NigoriSpecifics& nigori_specifics);
diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc
index c98023c..3f5d539 100644
--- a/sync/protocol/proto_value_conversions_unittest.cc
+++ b/sync/protocol/proto_value_conversions_unittest.cc
@@ -48,7 +48,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) {
// If this number changes, that means we added or removed a data
// type. Don't forget to add a unit test for {New
// type}SpecificsToValue below.
- EXPECT_EQ(18, MODEL_TYPE_COUNT);
+ EXPECT_EQ(19, MODEL_TYPE_COUNT);
// We'd also like to check if we changed any field in our messages.
// However, that's hard to do: sizeof could work, but it's
@@ -140,6 +140,10 @@ TEST_F(ProtoValueConversionsTest, ExtensionSpecificsToValue) {
TestSpecificsToValue(ExtensionSpecificsToValue);
}
+TEST_F(ProtoValueConversionsTest, HistoryDeleteDirectiveSpecificsToValue) {
+ TestSpecificsToValue(HistoryDeleteDirectiveSpecificsToValue);
+}
+
TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) {
TestSpecificsToValue(NigoriSpecificsToValue);
}
@@ -188,6 +192,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) {
SET_FIELD(bookmark);
SET_FIELD(extension);
SET_FIELD(extension_setting);
+ SET_FIELD(history_delete_directive);
SET_FIELD(nigori);
SET_FIELD(password);
SET_FIELD(device_info);
diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto
index ed4871b..b9d1310 100644
--- a/sync/protocol/sync.proto
+++ b/sync/protocol/sync.proto
@@ -26,6 +26,7 @@ import "encryption.proto";
import "extension_setting_specifics.proto";
import "extension_specifics.proto";
import "get_updates_caller_info.proto";
+import "history_delete_directive_specifics.proto";
import "nigori_specifics.proto";
import "password_specifics.proto";
import "preference_specifics.proto";
@@ -98,6 +99,7 @@ message EntitySpecifics {
optional SearchEngineSpecifics search_engine = 88610;
optional ExtensionSettingSpecifics extension_setting = 96159;
optional AppSettingSpecifics app_setting = 103656;
+ optional HistoryDeleteDirectiveSpecifics history_delete_directive = 150251;
optional DeviceInfoSpecifics device_info = 154522;
}
diff --git a/sync/protocol/sync_proto.gyp b/sync/protocol/sync_proto.gyp
index ce5aba6..d3b9e95 100644
--- a/sync/protocol/sync_proto.gyp
+++ b/sync/protocol/sync_proto.gyp
@@ -23,6 +23,7 @@
'extension_setting_specifics.proto',
'extension_specifics.proto',
'get_updates_caller_info.proto',
+ 'history_delete_directive_specifics.proto',
'nigori_specifics.proto',
'password_specifics.proto',
'preference_specifics.proto',