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

Unified Diff: sync/engine/syncer.cc

Issue 10455012: [Sync] Add support for performing a GetKey on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
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.

Powered by Google App Engine
This is Rietveld 408576698