OLD | NEW |
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 syncable::ModelTypeSet data_types; | 264 syncable::ModelTypeSet data_types; |
265 service_->GetRegisteredDataTypes(&data_types); | 265 service_->GetRegisteredDataTypes(&data_types); |
266 service_->EncryptDataTypes(data_types); | 266 service_->EncryptDataTypes(data_types); |
267 } | 267 } |
268 | 268 |
269 // If we are activating the passphrase, we need to have one supplied. | 269 // If we are activating the passphrase, we need to have one supplied. |
270 DCHECK(service_->IsUsingSecondaryPassphrase() || | 270 DCHECK(service_->IsUsingSecondaryPassphrase() || |
271 !configuration.use_secondary_passphrase || | 271 !configuration.use_secondary_passphrase || |
272 configuration.secondary_passphrase.length() > 0); | 272 configuration.secondary_passphrase.length() > 0); |
273 | 273 |
274 if (configuration.use_secondary_passphrase && | 274 if (configuration.use_secondary_passphrase) { |
275 !service_->IsUsingSecondaryPassphrase()) { | 275 if (!service_->IsUsingSecondaryPassphrase()) { |
276 service_->SetPassphrase(configuration.secondary_passphrase, true, true); | 276 service_->SetPassphrase(configuration.secondary_passphrase, true, true); |
277 tried_creating_explicit_passphrase_ = true; | 277 tried_creating_explicit_passphrase_ = true; |
| 278 } else { |
| 279 service_->SetPassphrase(configuration.secondary_passphrase, true, false); |
| 280 tried_setting_explicit_passphrase_ = true; |
| 281 } |
278 } | 282 } |
279 | 283 |
280 service_->OnUserChoseDatatypes(configuration.sync_everything, | 284 service_->OnUserChoseDatatypes(configuration.sync_everything, |
281 configuration.data_types); | 285 configuration.data_types); |
282 } | 286 } |
283 | 287 |
284 void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) { | 288 void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) { |
285 Advance(SyncSetupWizard::SETTING_UP); | 289 Advance(SyncSetupWizard::SETTING_UP); |
286 service_->SetPassphrase(passphrase, true, false); | 290 service_->SetPassphrase(passphrase, true, false); |
287 tried_setting_explicit_passphrase_ = true; | 291 tried_setting_explicit_passphrase_ = true; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 break; | 417 break; |
414 } | 418 } |
415 case SyncSetupWizard::DONE: | 419 case SyncSetupWizard::DONE: |
416 flow_handler_->ShowSetupDone( | 420 flow_handler_->ShowSetupDone( |
417 UTF16ToWide(service_->GetAuthenticatedUsername())); | 421 UTF16ToWide(service_->GetAuthenticatedUsername())); |
418 break; | 422 break; |
419 default: | 423 default: |
420 NOTREACHED() << "Invalid advance state: " << state; | 424 NOTREACHED() << "Invalid advance state: " << state; |
421 } | 425 } |
422 } | 426 } |
OLD | NEW |