Index: sync/engine/syncer.cc |
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc |
index 66afdbcde415def66eec4d52231182855fa04978..0f7b7a0052bb539eea0e5a3425842bd4c69583fd 100644 |
--- a/sync/engine/syncer.cc |
+++ b/sync/engine/syncer.cc |
@@ -15,6 +15,7 @@ |
#include "sync/engine/commit.h" |
#include "sync/engine/conflict_resolver.h" |
#include "sync/engine/download_updates_command.h" |
+#include "sync/engine/get_key_command.h" |
#include "sync/engine/net/server_connection_manager.h" |
#include "sync/engine/process_commit_response_command.h" |
#include "sync/engine/process_updates_command.h" |
@@ -52,6 +53,7 @@ const char* SyncerStepToString(const SyncerStep step) |
{ |
switch (step) { |
ENUM_CASE(SYNCER_BEGIN); |
+ ENUM_CASE(GET_ENCRYPTION_KEY); |
ENUM_CASE(DOWNLOAD_UPDATES); |
ENUM_CASE(PROCESS_CLIENT_COMMAND); |
ENUM_CASE(VERIFY_UPDATES); |
@@ -106,6 +108,20 @@ void Syncer::SyncShare(sessions::SyncSession* session, |
next_step = DOWNLOAD_UPDATES; |
break; |
+ case GET_ENCRYPTION_KEY: { |
+ GetKeyCommand get_key; |
+ SyncerError result = get_key.Execute(session); |
+ session->mutable_status_controller()->set_last_get_key_result(result); |
+ if (result == SYNCER_OK && last_step != GET_ENCRYPTION_KEY) { |
+ next_step = DOWNLOAD_UPDATES; |
+ } else { |
+ LOG_IF(ERROR, result != SYNCER_OK) |
+ << "Aborting sync cycle due to get key failure."; |
+ last_step = SYNCER_END; // Necessary for CONFIGURATION mode. |
+ next_step = SYNCER_END; |
+ } |
+ break; |
+ } |
case DOWNLOAD_UPDATES: { |
// TODO(akalin): We may want to propagate this switch up |
// eventually. |