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

Side by Side Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 7551024: [Sync] Fix encryption/passphrase handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/sync_setup_flow.h" 5 #include "chrome/browser/sync/sync_setup_flow.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 const std::string& password, 255 const std::string& password,
256 const std::string& captcha, 256 const std::string& captcha,
257 const std::string& access_code) { 257 const std::string& access_code) {
258 service_->OnUserSubmittedAuth(username, password, captcha, access_code); 258 service_->OnUserSubmittedAuth(username, password, captcha, access_code);
259 } 259 }
260 260
261 void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) { 261 void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) {
262 // Go to the "loading..." screen. 262 // Go to the "loading..." screen.
263 Advance(SyncSetupWizard::SETTING_UP); 263 Advance(SyncSetupWizard::SETTING_UP);
264 264
265 // Note: encryption calls must be made before OnUserChoseDatatypes.
266 // TODO(zea): Fix this.
265 if (configuration.encrypt_all) { 267 if (configuration.encrypt_all) {
266 syncable::ModelTypeSet data_types; 268 syncable::ModelTypeSet data_types;
267 service_->GetRegisteredDataTypes(&data_types); 269 service_->GetRegisteredDataTypes(&data_types);
268 service_->EncryptDataTypes(data_types); 270 service_->EncryptDataTypes(data_types);
271 } else {
272 // Necessary in case we had attempted to encrypt datatypes previously
273 // but were unable to complete and the user wants to cancel out (for
274 // example due to needing a passphrase).
275 service_->EncryptDataTypes(syncable::ModelTypeSet());
269 } 276 }
270 277
271 // If we are activating the passphrase, we need to have one supplied. 278 // If we are activating the passphrase, we need to have one supplied.
272 DCHECK(service_->IsUsingSecondaryPassphrase() || 279 DCHECK(service_->IsUsingSecondaryPassphrase() ||
273 !configuration.use_secondary_passphrase || 280 !configuration.use_secondary_passphrase ||
274 configuration.secondary_passphrase.length() > 0); 281 configuration.secondary_passphrase.length() > 0);
275 282
276 if (configuration.use_secondary_passphrase) { 283 if (configuration.use_secondary_passphrase) {
277 if (!service_->IsUsingSecondaryPassphrase()) { 284 if (!service_->IsUsingSecondaryPassphrase()) {
278 service_->SetPassphrase(configuration.secondary_passphrase, true, true); 285 service_->SetPassphrase(configuration.secondary_passphrase, true, true);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 break; 434 break;
428 } 435 }
429 case SyncSetupWizard::DONE: 436 case SyncSetupWizard::DONE:
430 flow_handler_->ShowSetupDone( 437 flow_handler_->ShowSetupDone(
431 UTF16ToWide(service_->GetAuthenticatedUsername())); 438 UTF16ToWide(service_->GetAuthenticatedUsername()));
432 break; 439 break;
433 default: 440 default:
434 NOTREACHED() << "Invalid advance state: " << state; 441 NOTREACHED() << "Invalid advance state: " << state;
435 } 442 }
436 } 443 }
OLDNEW
« chrome/browser/sync/profile_sync_service.cc ('K') | « chrome/browser/sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698