| Index: components/sync/tools/sync_client.cc
|
| diff --git a/sync/tools/sync_client.cc b/components/sync/tools/sync_client.cc
|
| similarity index 85%
|
| rename from sync/tools/sync_client.cc
|
| rename to components/sync/tools/sync_client.cc
|
| index 2105782f934d10f6905409f50fce1c916879e180..e6e12effefba504a5ad8667697669beb28a7c6b8 100644
|
| --- a/sync/tools/sync_client.cc
|
| +++ b/components/sync/tools/sync_client.cc
|
| @@ -28,6 +28,22 @@
|
| #include "build/build_config.h"
|
| #include "components/invalidation/impl/non_blocking_invalidator.h"
|
| #include "components/invalidation/public/object_id_invalidation_map.h"
|
| +#include "components/sync/base/cancelation_signal.h"
|
| +#include "components/sync/base/model_type.h"
|
| +#include "components/sync/base/unrecoverable_error_handler.h"
|
| +#include "components/sync/base/weak_handle.h"
|
| +#include "components/sync/core/base_node.h"
|
| +#include "components/sync/core/http_bridge.h"
|
| +#include "components/sync/core/http_post_provider_factory.h"
|
| +#include "components/sync/core/internal_components_factory_impl.h"
|
| +#include "components/sync/core/read_node.h"
|
| +#include "components/sync/core/sync_manager.h"
|
| +#include "components/sync/core/sync_manager_factory.h"
|
| +#include "components/sync/engine/passive_model_worker.h"
|
| +#include "components/sync/js/js_event_details.h"
|
| +#include "components/sync/js/js_event_handler.h"
|
| +#include "components/sync/test/fake_encryptor.h"
|
| +#include "components/sync/tools/null_invalidation_state_tracker.h"
|
| #include "components/sync_driver/invalidation_helper.h"
|
| #include "jingle/notifier/base/notification_method.h"
|
| #include "jingle/notifier/base/notifier_options.h"
|
| @@ -36,22 +52,6 @@
|
| #include "net/dns/host_resolver.h"
|
| #include "net/http/transport_security_state.h"
|
| #include "net/url_request/url_request_test_util.h"
|
| -#include "sync/internal_api/public/base/cancelation_signal.h"
|
| -#include "sync/internal_api/public/base/model_type.h"
|
| -#include "sync/internal_api/public/base_node.h"
|
| -#include "sync/internal_api/public/engine/passive_model_worker.h"
|
| -#include "sync/internal_api/public/http_bridge.h"
|
| -#include "sync/internal_api/public/http_post_provider_factory.h"
|
| -#include "sync/internal_api/public/internal_components_factory_impl.h"
|
| -#include "sync/internal_api/public/read_node.h"
|
| -#include "sync/internal_api/public/sync_manager.h"
|
| -#include "sync/internal_api/public/sync_manager_factory.h"
|
| -#include "sync/internal_api/public/util/unrecoverable_error_handler.h"
|
| -#include "sync/internal_api/public/util/weak_handle.h"
|
| -#include "sync/js/js_event_details.h"
|
| -#include "sync/js/js_event_handler.h"
|
| -#include "sync/test/fake_encryptor.h"
|
| -#include "sync/tools/null_invalidation_state_tracker.h"
|
| #include "url/gurl.h"
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -140,15 +140,14 @@ class LoggingChangeDelegate : public SyncManager::ChangeDelegate {
|
| int64_t model_version,
|
| const BaseTransaction* trans,
|
| const ImmutableChangeRecordList& changes) override {
|
| - LOG(INFO) << "Changes applied for "
|
| - << ModelTypeToString(model_type);
|
| + LOG(INFO) << "Changes applied for " << ModelTypeToString(model_type);
|
| size_t i = 1;
|
| size_t change_count = changes.Get().size();
|
| - for (ChangeRecordList::const_iterator it =
|
| - changes.Get().begin(); it != changes.Get().end(); ++it) {
|
| + for (ChangeRecordList::const_iterator it = changes.Get().begin();
|
| + it != changes.Get().end(); ++it) {
|
| std::unique_ptr<base::DictionaryValue> change_value(it->ToValue());
|
| - LOG(INFO) << "Change (" << i << "/" << change_count << "): "
|
| - << ValueToString(*change_value);
|
| + LOG(INFO) << "Change (" << i << "/" << change_count
|
| + << "): " << ValueToString(*change_value);
|
| if (it->action != ChangeRecord::ACTION_DELETE) {
|
| ReadNode node(trans);
|
| CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK);
|
| @@ -160,13 +159,11 @@ class LoggingChangeDelegate : public SyncManager::ChangeDelegate {
|
| }
|
|
|
| void OnChangesComplete(ModelType model_type) override {
|
| - LOG(INFO) << "Changes complete for "
|
| - << ModelTypeToString(model_type);
|
| + LOG(INFO) << "Changes complete for " << ModelTypeToString(model_type);
|
| }
|
| };
|
|
|
| -class LoggingUnrecoverableErrorHandler
|
| - : public UnrecoverableErrorHandler {
|
| +class LoggingUnrecoverableErrorHandler : public UnrecoverableErrorHandler {
|
| public:
|
| ~LoggingUnrecoverableErrorHandler() override {}
|
|
|
| @@ -174,7 +171,8 @@ class LoggingUnrecoverableErrorHandler
|
| const std::string& message) override {
|
| if (LOG_IS_ON(ERROR)) {
|
| logging::LogMessage(from_here.file_name(), from_here.line_number(),
|
| - logging::LOG_ERROR).stream()
|
| + logging::LOG_ERROR)
|
| + .stream()
|
| << message;
|
| }
|
| }
|
| @@ -229,8 +227,7 @@ class InvalidatorShim : public InvalidationHandler {
|
| const ObjectIdInvalidationMap& invalidation_map) override {
|
| syncer::ObjectIdSet ids = invalidation_map.GetObjectIds();
|
| for (syncer::ObjectIdSet::const_iterator ids_it = ids.begin();
|
| - ids_it != ids.end();
|
| - ++ids_it) {
|
| + ids_it != ids.end(); ++ids_it) {
|
| syncer::ModelType type;
|
| if (!NotificationTypeToRealModelType(ids_it->name(), &type)) {
|
| DLOG(WARNING) << "Notification has invalid id: "
|
| @@ -240,8 +237,7 @@ class InvalidatorShim : public InvalidationHandler {
|
| invalidation_map.ForObject(*ids_it);
|
| for (syncer::SingleObjectInvalidationSet::const_iterator inv_it =
|
| invalidation_set.begin();
|
| - inv_it != invalidation_set.end();
|
| - ++inv_it) {
|
| + inv_it != invalidation_set.end(); ++inv_it) {
|
| std::unique_ptr<syncer::InvalidationInterface> inv_adapter(
|
| new InvalidationAdapter(*inv_it));
|
| sync_manager_->OnIncomingInvalidation(type, std::move(inv_adapter));
|
| @@ -268,9 +264,8 @@ notifier::NotifierOptions ParseNotifierOptions(
|
| notifier_options.auth_mechanism = "X-OAUTH2";
|
|
|
| if (command_line.HasSwitch(kXmppHostPortSwitch)) {
|
| - notifier_options.xmpp_host_port =
|
| - net::HostPortPair::FromString(
|
| - command_line.GetSwitchValueASCII(kXmppHostPortSwitch));
|
| + notifier_options.xmpp_host_port = net::HostPortPair::FromString(
|
| + command_line.GetSwitchValueASCII(kXmppHostPortSwitch));
|
| LOG(INFO) << "Using " << notifier_options.xmpp_host_port.ToString()
|
| << " for test sync notification server.";
|
| }
|
| @@ -290,8 +285,7 @@ notifier::NotifierOptions ParseNotifierOptions(
|
|
|
| void StubNetworkTimeUpdateCallback(const base::Time&,
|
| const base::TimeDelta&,
|
| - const base::TimeDelta&) {
|
| -}
|
| + const base::TimeDelta&) {}
|
|
|
| int SyncClientMain(int argc, char* argv[]) {
|
| #if defined(OS_MACOSX)
|
| @@ -319,16 +313,15 @@ int SyncClientMain(int argc, char* argv[]) {
|
| // TODO(akalin): Write a wrapper script that gets a token for an
|
| // email and password and passes that in to this utility.
|
| if (credentials.email.empty() || credentials.sync_token.empty()) {
|
| - std::printf("Usage: %s --%s=foo@bar.com --%s=token\n"
|
| - "[--%s=host:port] [--%s] [--%s]\n"
|
| - "Run chrome and set a breakpoint on\n"
|
| - "syncer::SyncManagerImpl::UpdateCredentials() "
|
| - "after logging into\n"
|
| - "sync to get the token to pass into this utility.\n",
|
| - argv[0],
|
| - kEmailSwitch, kTokenSwitch, kXmppHostPortSwitch,
|
| - kXmppTrySslTcpFirstSwitch,
|
| - kXmppAllowInsecureConnectionSwitch);
|
| + std::printf(
|
| + "Usage: %s --%s=foo@bar.com --%s=token\n"
|
| + "[--%s=host:port] [--%s] [--%s]\n"
|
| + "Run chrome and set a breakpoint on\n"
|
| + "syncer::SyncManagerImpl::UpdateCredentials() "
|
| + "after logging into\n"
|
| + "sync to get the token to pass into this utility.\n",
|
| + argv[0], kEmailSwitch, kTokenSwitch, kXmppHostPortSwitch,
|
| + kXmppTrySslTcpFirstSwitch, kXmppAllowInsecureConnectionSwitch);
|
| return -1;
|
| }
|
|
|
| @@ -387,13 +380,12 @@ int SyncClientMain(int argc, char* argv[]) {
|
| model_types.Put(FAVICON_TRACKING);
|
|
|
| ModelSafeRoutingInfo routing_info;
|
| - for (ModelTypeSet::Iterator it = model_types.First();
|
| - it.Good(); it.Inc()) {
|
| + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
|
| routing_info[it.Get()] = GROUP_PASSIVE;
|
| }
|
| scoped_refptr<PassiveModelWorker> passive_model_safe_worker =
|
| new PassiveModelWorker(nullptr);
|
| - std::vector<scoped_refptr<ModelSafeWorker> > workers;
|
| + std::vector<scoped_refptr<ModelSafeWorker>> workers;
|
| workers.push_back(passive_model_safe_worker);
|
|
|
| // Set up sync manager.
|
| @@ -420,8 +412,7 @@ int SyncClientMain(int argc, char* argv[]) {
|
| NullEncryptor null_encryptor;
|
| InternalComponentsFactoryImpl::Switches factory_switches = {
|
| InternalComponentsFactory::ENCRYPTION_KEYSTORE,
|
| - InternalComponentsFactory::BACKOFF_NORMAL
|
| - };
|
| + InternalComponentsFactory::BACKOFF_NORMAL};
|
| CancelationSignal scm_cancelation_signal;
|
|
|
| SyncManager::InitArgs args;
|
|
|