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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. | |
265 if (configuration.encrypt_all) { | 266 if (configuration.encrypt_all) { |
266 syncable::ModelTypeSet data_types; | 267 syncable::ModelTypeSet data_types; |
267 service_->GetRegisteredDataTypes(&data_types); | 268 service_->GetRegisteredDataTypes(&data_types); |
268 service_->EncryptDataTypes(data_types); | 269 service_->EncryptDataTypes(data_types); |
270 } else { | |
271 // Necessary in case we had attempted to encrypt datatypes previously | |
272 // but were unable to complete and the user wants to cancel out (for | |
273 // example due to needing a passphrase). | |
tim (not reviewing)
2011/08/04 16:57:56
hmm.. this seems odd.. but if we must can we pull
Nicolas Zea
2011/08/04 18:43:54
Done.
| |
274 service_->EncryptDataTypes(syncable::ModelTypeSet()); | |
269 } | 275 } |
270 | 276 |
271 // If we are activating the passphrase, we need to have one supplied. | 277 // If we are activating the passphrase, we need to have one supplied. |
272 DCHECK(service_->IsUsingSecondaryPassphrase() || | 278 DCHECK(service_->IsUsingSecondaryPassphrase() || |
273 !configuration.use_secondary_passphrase || | 279 !configuration.use_secondary_passphrase || |
274 configuration.secondary_passphrase.length() > 0); | 280 configuration.secondary_passphrase.length() > 0); |
275 | 281 |
276 if (configuration.use_secondary_passphrase) { | 282 if (configuration.use_secondary_passphrase) { |
277 if (!service_->IsUsingSecondaryPassphrase()) { | 283 if (!service_->IsUsingSecondaryPassphrase()) { |
278 service_->SetPassphrase(configuration.secondary_passphrase, true, true); | 284 service_->SetPassphrase(configuration.secondary_passphrase, true, true); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 break; | 433 break; |
428 } | 434 } |
429 case SyncSetupWizard::DONE: | 435 case SyncSetupWizard::DONE: |
430 flow_handler_->ShowSetupDone( | 436 flow_handler_->ShowSetupDone( |
431 UTF16ToWide(service_->GetAuthenticatedUsername())); | 437 UTF16ToWide(service_->GetAuthenticatedUsername())); |
432 break; | 438 break; |
433 default: | 439 default: |
434 NOTREACHED() << "Invalid advance state: " << state; | 440 NOTREACHED() << "Invalid advance state: " << state; |
435 } | 441 } |
436 } | 442 } |
OLD | NEW |