diff options
Diffstat (limited to 'sync/tools')
-rw-r--r-- | sync/tools/BUILD.gn | 2 | ||||
-rw-r--r-- | sync/tools/DEPS | 1 | ||||
-rw-r--r-- | sync/tools/invalidation_helper.cc | 35 | ||||
-rw-r--r-- | sync/tools/invalidation_helper.h | 21 | ||||
-rw-r--r-- | sync/tools/sync_client.cc | 2 | ||||
-rw-r--r-- | sync/tools/sync_listen_notifications.cc | 2 | ||||
-rw-r--r-- | sync/tools/sync_tools.gyp | 4 |
7 files changed, 62 insertions, 5 deletions
diff --git a/sync/tools/BUILD.gn b/sync/tools/BUILD.gn index 766803b..fc6f7ae 100644 --- a/sync/tools/BUILD.gn +++ b/sync/tools/BUILD.gn @@ -10,6 +10,8 @@ if (is_linux && !is_chromeos) { testonly = true sources = [ + "invalidation_helper.cc", + "invalidation_helper.h", "null_invalidation_state_tracker.cc", "null_invalidation_state_tracker.h", ] diff --git a/sync/tools/DEPS b/sync/tools/DEPS index a7e3a39..b132cd2 100644 --- a/sync/tools/DEPS +++ b/sync/tools/DEPS @@ -1,6 +1,5 @@ include_rules = [ "+components/invalidation", - "+components/sync_driver", "+google/cacheinvalidation", "+jingle/notifier/base", "+net", diff --git a/sync/tools/invalidation_helper.cc b/sync/tools/invalidation_helper.cc new file mode 100644 index 0000000..61a4b87 --- /dev/null +++ b/sync/tools/invalidation_helper.cc @@ -0,0 +1,35 @@ +// Copyright 2014 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. + +#include "sync/tools/invalidation_helper.h" + +#include "google/cacheinvalidation/types.pb.h" + +namespace syncer { + +bool RealModelTypeToObjectId(ModelType model_type, + invalidation::ObjectId* object_id) { + std::string notification_type; + if (!RealModelTypeToNotificationType(model_type, ¬ification_type)) { + return false; + } + object_id->Init(ipc::invalidation::ObjectSource::CHROME_SYNC, + notification_type); + return true; +} + +ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet model_types) { + ObjectIdSet ids; + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { + invalidation::ObjectId model_type_as_id; + if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) { + DLOG(WARNING) << "Invalid model type " << it.Get(); + continue; + } + ids.insert(model_type_as_id); + } + return ids; +} + +} // namespace syncer diff --git a/sync/tools/invalidation_helper.h b/sync/tools/invalidation_helper.h new file mode 100644 index 0000000..c26c6ef --- /dev/null +++ b/sync/tools/invalidation_helper.h @@ -0,0 +1,21 @@ +// Copyright 2014 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. + +#ifndef SYNC_TOOLS_INVALIDATION_HELPER_H_ +#define SYNC_TOOLS_INVALIDATION_HELPER_H_ + +#include "components/invalidation/public/invalidation_util.h" +#include "google/cacheinvalidation/include/types.h" +#include "sync/internal_api/public/base/model_type.h" + +namespace syncer { + +bool RealModelTypeToObjectId(ModelType model_type, + invalidation::ObjectId* object_id); + +ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet model_types); + +} + +#endif // SYNC_TOOLS_INVALIDATION_HELPER_H diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc index d8653ec..d64041f 100644 --- a/sync/tools/sync_client.cc +++ b/sync/tools/sync_client.cc @@ -22,7 +22,6 @@ #include "base/threading/thread.h" #include "components/invalidation/impl/non_blocking_invalidator.h" #include "components/invalidation/public/object_id_invalidation_map.h" -#include "components/sync_driver/invalidation_helper.h" #include "jingle/notifier/base/notification_method.h" #include "jingle/notifier/base/notifier_options.h" #include "net/base/host_port_pair.h" @@ -45,6 +44,7 @@ #include "sync/js/js_event_details.h" #include "sync/js/js_event_handler.h" #include "sync/test/fake_encryptor.h" +#include "sync/tools/invalidation_helper.h" #include "sync/tools/null_invalidation_state_tracker.h" #include "url/gurl.h" diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc index 1903f7f..3a1d808 100644 --- a/sync/tools/sync_listen_notifications.cc +++ b/sync/tools/sync_listen_notifications.cc @@ -21,7 +21,6 @@ #include "components/invalidation/public/invalidation_handler.h" #include "components/invalidation/public/invalidation_util.h" #include "components/invalidation/public/object_id_invalidation_map.h" -#include "components/sync_driver/invalidation_helper.h" #include "jingle/notifier/base/notification_method.h" #include "jingle/notifier/base/notifier_options.h" #include "net/base/host_port_pair.h" @@ -30,6 +29,7 @@ #include "net/http/transport_security_state.h" #include "net/url_request/url_request_test_util.h" #include "sync/internal_api/public/base/model_type.h" +#include "sync/tools/invalidation_helper.h" #include "sync/tools/null_invalidation_state_tracker.h" #if defined(OS_MACOSX) diff --git a/sync/tools/sync_tools.gyp b/sync/tools/sync_tools.gyp index 49382a5..287178f 100644 --- a/sync/tools/sync_tools.gyp +++ b/sync/tools/sync_tools.gyp @@ -25,6 +25,8 @@ '../sync.gyp:sync', ], 'sources': [ + 'invalidation_helper.cc', + 'invalidation_helper.h', 'null_invalidation_state_tracker.cc', 'null_invalidation_state_tracker.h', ], @@ -40,7 +42,6 @@ 'dependencies': [ '../../base/base.gyp:base', '../../components/components.gyp:invalidation_impl', - '../../components/components.gyp:sync_driver', '../../jingle/jingle.gyp:notifier', '../../net/net.gyp:net', '../../net/net.gyp:net_test_support', @@ -63,7 +64,6 @@ 'dependencies': [ '../../base/base.gyp:base', '../../components/components.gyp:invalidation_impl', - '../../components/components.gyp:sync_driver', '../../jingle/jingle.gyp:notifier', '../../net/net.gyp:net', '../../net/net.gyp:net_test_support', |