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

Unified Diff: sync/tools/sync_client.cc

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent 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/test/null_transaction_observer.cc ('k') | sync/tools/sync_listen_notifications.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/tools/sync_client.cc
diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc
index 51d1c68f40d9c78038bd8d278a9f043c08bf627e..caa6ee61e6f6afe399da5e57b7afe0f2736ac652 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -53,6 +53,7 @@
// TODO(akalin): Refactor to combine shared code with
// sync_listen_notifications.
+namespace syncer {
namespace {
const char kEmailSwitch[] = "email";
@@ -65,22 +66,20 @@ const char kNotificationMethodSwitch[] = "notification-method";
class NullInvalidationStateTracker
: public base::SupportsWeakPtr<NullInvalidationStateTracker>,
- public syncer::InvalidationStateTracker {
+ public InvalidationStateTracker {
public:
NullInvalidationStateTracker() {}
virtual ~NullInvalidationStateTracker() {}
- virtual syncer::InvalidationVersionMap
- GetAllMaxVersions() const OVERRIDE {
- return syncer::InvalidationVersionMap();
+ virtual InvalidationVersionMap GetAllMaxVersions() const OVERRIDE {
+ return InvalidationVersionMap();
}
virtual void SetMaxVersion(
const invalidation::ObjectId& id,
int64 max_invalidation_version) OVERRIDE {
VLOG(1) << "Setting max invalidation version for "
- << syncer::ObjectIdToString(id) << " to "
- << max_invalidation_version;
+ << ObjectIdToString(id) << " to " << max_invalidation_version;
}
virtual std::string GetInvalidationState() const OVERRIDE {
@@ -130,7 +129,7 @@ class MyTestURLRequestContextGetter : public TestURLRequestContextGetter {
};
// TODO(akalin): Use system encryptor once it's moved to sync/.
-class NullEncryptor : public syncer::Encryptor {
+class NullEncryptor : public Encryptor {
public:
virtual ~NullEncryptor() {}
@@ -153,26 +152,26 @@ std::string ValueToString(const Value& value) {
return str;
}
-class LoggingChangeDelegate : public syncer::SyncManager::ChangeDelegate {
+class LoggingChangeDelegate : public SyncManager::ChangeDelegate {
public:
virtual ~LoggingChangeDelegate() {}
virtual void OnChangesApplied(
- syncer::ModelType model_type,
- const syncer::BaseTransaction* trans,
- const syncer::ImmutableChangeRecordList& changes) OVERRIDE {
+ ModelType model_type,
+ const BaseTransaction* trans,
+ const ImmutableChangeRecordList& changes) OVERRIDE {
LOG(INFO) << "Changes applied for "
- << syncer::ModelTypeToString(model_type);
+ << ModelTypeToString(model_type);
size_t i = 1;
size_t change_count = changes.Get().size();
- for (syncer::ChangeRecordList::const_iterator it =
+ for (ChangeRecordList::const_iterator it =
changes.Get().begin(); it != changes.Get().end(); ++it) {
scoped_ptr<base::DictionaryValue> change_value(it->ToValue());
LOG(INFO) << "Change (" << i << "/" << change_count << "): "
<< ValueToString(*change_value);
- if (it->action != syncer::ChangeRecord::ACTION_DELETE) {
- syncer::ReadNode node(trans);
- CHECK_EQ(node.InitByIdLookup(it->id), syncer::BaseNode::INIT_OK);
+ if (it->action != ChangeRecord::ACTION_DELETE) {
+ ReadNode node(trans);
+ CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK);
scoped_ptr<base::DictionaryValue> details(node.GetDetailsAsValue());
VLOG(1) << "Details: " << ValueToString(*details);
}
@@ -180,14 +179,14 @@ class LoggingChangeDelegate : public syncer::SyncManager::ChangeDelegate {
}
}
- virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE {
+ virtual void OnChangesComplete(ModelType model_type) OVERRIDE {
LOG(INFO) << "Changes complete for "
- << syncer::ModelTypeToString(model_type);
+ << ModelTypeToString(model_type);
}
};
class LoggingUnrecoverableErrorHandler
- : public syncer::UnrecoverableErrorHandler {
+ : public UnrecoverableErrorHandler {
public:
virtual ~LoggingUnrecoverableErrorHandler() {}
@@ -202,14 +201,14 @@ class LoggingUnrecoverableErrorHandler
};
class LoggingJsEventHandler
- : public syncer::JsEventHandler,
+ : public JsEventHandler,
public base::SupportsWeakPtr<LoggingJsEventHandler> {
public:
virtual ~LoggingJsEventHandler() {}
virtual void HandleJsEvent(
const std::string& name,
- const syncer::JsEventDetails& details) OVERRIDE {
+ const JsEventDetails& details) OVERRIDE {
VLOG(1) << name << ": " << details.ToString();
}
};
@@ -253,9 +252,7 @@ notifier::NotifierOptions ParseNotifierOptions(
return notifier_options;
}
-} // namespace
-
-int main(int argc, char* argv[]) {
+int SyncClientMain(int argc, char* argv[]) {
#if defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool pool;
#endif
@@ -276,7 +273,7 @@ int main(int argc, char* argv[]) {
// Parse command line.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- syncer::SyncCredentials credentials;
+ SyncCredentials credentials;
credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch);
credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch);
// TODO(akalin): Write a wrapper script that gets a token for an
@@ -308,7 +305,7 @@ int main(int argc, char* argv[]) {
ParseNotifierOptions(command_line, context_getter);
const char kClientInfo[] = "sync_listen_notifications";
NullInvalidationStateTracker null_invalidation_state_tracker;
- syncer::SyncNotifierFactory sync_notifier_factory(
+ SyncNotifierFactory sync_notifier_factory(
notifier_options, kClientInfo,
null_invalidation_state_tracker.AsWeakPtr());
@@ -317,20 +314,20 @@ int main(int argc, char* argv[]) {
CHECK(database_dir.CreateUniqueTempDir());
// Set up model type parameters.
- const syncer::ModelTypeSet model_types = syncer::ModelTypeSet::All();
- syncer::ModelSafeRoutingInfo routing_info;
- for (syncer::ModelTypeSet::Iterator it = model_types.First();
+ const ModelTypeSet model_types = ModelTypeSet::All();
+ ModelSafeRoutingInfo routing_info;
+ for (ModelTypeSet::Iterator it = model_types.First();
it.Good(); it.Inc()) {
- routing_info[it.Get()] = syncer::GROUP_PASSIVE;
+ routing_info[it.Get()] = GROUP_PASSIVE;
}
- scoped_refptr<syncer::PassiveModelWorker> passive_model_safe_worker =
- new syncer::PassiveModelWorker(&sync_loop);
- std::vector<syncer::ModelSafeWorker*> workers;
+ scoped_refptr<PassiveModelWorker> passive_model_safe_worker =
+ new PassiveModelWorker(&sync_loop);
+ std::vector<ModelSafeWorker*> workers;
workers.push_back(passive_model_safe_worker.get());
// Set up sync manager.
- syncer::SyncManagerFactory sync_manager_factory;
- scoped_ptr<syncer::SyncManager> sync_manager =
+ SyncManagerFactory sync_manager_factory;
+ scoped_ptr<SyncManager> sync_manager =
sync_manager_factory.CreateSyncManager("sync_client manager");
LoggingJsEventHandler js_event_handler;
const char kSyncServerAndPath[] = "clients4.google.com/chrome-sync/dev";
@@ -341,17 +338,17 @@ int main(int argc, char* argv[]) {
const char kUserAgent[] = "sync_client";
// TODO(akalin): Replace this with just the context getter once
// HttpPostProviderFactory is removed.
- scoped_ptr<syncer::HttpPostProviderFactory> post_factory(
- new syncer::HttpBridgeFactory(context_getter, kUserAgent));
+ scoped_ptr<HttpPostProviderFactory> post_factory(
+ new HttpBridgeFactory(context_getter, kUserAgent));
// Used only when committing bookmarks, so it's okay to leave this
// as NULL.
- syncer::ExtensionsActivityMonitor* extensions_activity_monitor = NULL;
+ ExtensionsActivityMonitor* extensions_activity_monitor = NULL;
LoggingChangeDelegate change_delegate;
const char kRestoredKeyForBootstrapping[] = "";
NullEncryptor null_encryptor;
LoggingUnrecoverableErrorHandler unrecoverable_error_handler;
sync_manager->Init(database_dir.path(),
- syncer::WeakHandle<syncer::JsEventHandler>(
+ WeakHandle<JsEventHandler>(
js_event_handler.AsWeakPtr()),
kSyncServerAndPath,
kSyncServerPort,
@@ -363,16 +360,16 @@ int main(int argc, char* argv[]) {
extensions_activity_monitor,
&change_delegate,
credentials,
- scoped_ptr<syncer::SyncNotifier>(
+ scoped_ptr<SyncNotifier>(
sync_notifier_factory.CreateSyncNotifier()),
kRestoredKeyForBootstrapping,
- scoped_ptr<syncer::InternalComponentsFactory>(
- new syncer::InternalComponentsFactoryImpl()),
+ scoped_ptr<InternalComponentsFactory>(
+ new InternalComponentsFactoryImpl()),
&null_encryptor,
&unrecoverable_error_handler,
&LogUnrecoverableErrorContext);
- // TODO(akalin): We have pass in model parameters multiple times.
- // Organize handling of model types.
+ // TODO(akalin): Avoid passing in model parameters multiple times by
+ // organizing handling of model types.
sync_manager->UpdateEnabledTypes(model_types);
sync_manager->StartSyncingNormally(routing_info);
@@ -381,3 +378,10 @@ int main(int argc, char* argv[]) {
io_thread.Stop();
return 0;
}
+
+} // namespace
+} // namespace syncer
+
+int main(int argc, char* argv[]) {
+ return syncer::SyncClientMain(argc, argv);
+}
« no previous file with comments | « sync/test/null_transaction_observer.cc ('k') | sync/tools/sync_listen_notifications.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698