OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/engine/syncapi.h" | 5 #include "chrome/browser/sync/engine/syncapi.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <iomanip> | 9 #include <iomanip> |
10 #include <list> | 10 #include <list> |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 KeyParams params = {"localhost", "dummy", passphrase}; | 1501 KeyParams params = {"localhost", "dummy", passphrase}; |
1502 if (cryptographer->has_pending_keys()) { | 1502 if (cryptographer->has_pending_keys()) { |
1503 if (!cryptographer->DecryptPendingKeys(params)) { | 1503 if (!cryptographer->DecryptPendingKeys(params)) { |
1504 observer_->OnPassphraseRequired(); | 1504 observer_->OnPassphraseRequired(); |
1505 return; | 1505 return; |
1506 } | 1506 } |
1507 // Nudge the syncer so that passwords updates that were waiting for this | 1507 // Nudge the syncer so that passwords updates that were waiting for this |
1508 // passphrase get applied as soon as possible. | 1508 // passphrase get applied as soon as possible. |
1509 sync_manager_->RequestNudge(); | 1509 sync_manager_->RequestNudge(); |
1510 } else { | 1510 } else { |
| 1511 WriteTransaction trans(GetUserShare()); |
| 1512 WriteNode node(&trans); |
| 1513 if (!node.InitByTagLookup(kNigoriTag)) { |
| 1514 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. |
| 1515 NOTREACHED(); |
| 1516 return; |
| 1517 } |
1511 cryptographer->AddKey(params); | 1518 cryptographer->AddKey(params); |
1512 // TODO(albertb): Update the Nigori node on the server with the new keys. | 1519 |
| 1520 sync_pb::NigoriSpecifics specifics; |
| 1521 cryptographer->GetKeys(specifics.mutable_encrypted()); |
| 1522 node.SetNigoriSpecifics(specifics); |
1513 } | 1523 } |
1514 observer_->OnPassphraseAccepted(); | 1524 observer_->OnPassphraseAccepted(); |
1515 } | 1525 } |
1516 | 1526 |
1517 SyncManager::~SyncManager() { | 1527 SyncManager::~SyncManager() { |
1518 delete data_; | 1528 delete data_; |
1519 } | 1529 } |
1520 | 1530 |
1521 void SyncManager::SetObserver(Observer* observer) { | 1531 void SyncManager::SetObserver(Observer* observer) { |
1522 data_->set_observer(observer); | 1532 data_->set_observer(observer); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 UserShare* SyncManager::GetUserShare() const { | 2108 UserShare* SyncManager::GetUserShare() const { |
2099 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 2109 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
2100 return data_->GetUserShare(); | 2110 return data_->GetUserShare(); |
2101 } | 2111 } |
2102 | 2112 |
2103 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { | 2113 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { |
2104 delete pre_deletion_data; | 2114 delete pre_deletion_data; |
2105 } | 2115 } |
2106 | 2116 |
2107 } // namespace sync_api | 2117 } // namespace sync_api |
OLD | NEW |