| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <iomanip> | 9 #include <iomanip> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2432 if (!node.InitByTagLookup(kNigoriTag)) { | 2432 if (!node.InitByTagLookup(kNigoriTag)) { |
| 2433 DCHECK(!event.snapshot->is_share_usable); | 2433 DCHECK(!event.snapshot->is_share_usable); |
| 2434 return; | 2434 return; |
| 2435 } | 2435 } |
| 2436 const sync_pb::NigoriSpecifics& nigori = node.GetNigoriSpecifics(); | 2436 const sync_pb::NigoriSpecifics& nigori = node.GetNigoriSpecifics(); |
| 2437 syncable::ModelTypeSet encrypted_types = | 2437 syncable::ModelTypeSet encrypted_types = |
| 2438 syncable::GetEncryptedDataTypesFromNigori(nigori); | 2438 syncable::GetEncryptedDataTypesFromNigori(nigori); |
| 2439 // If passwords are enabled, they're automatically considered encrypted. | 2439 // If passwords are enabled, they're automatically considered encrypted. |
| 2440 if (enabled_types.count(syncable::PASSWORDS) > 0) | 2440 if (enabled_types.count(syncable::PASSWORDS) > 0) |
| 2441 encrypted_types.insert(syncable::PASSWORDS); | 2441 encrypted_types.insert(syncable::PASSWORDS); |
| 2442 if (encrypted_types.size() > 0) { | 2442 if (!encrypted_types.empty()) { |
| 2443 Cryptographer* cryptographer = | 2443 Cryptographer* cryptographer = |
| 2444 GetUserShare()->dir_manager->cryptographer(); | 2444 GetUserShare()->dir_manager->cryptographer(); |
| 2445 if (!cryptographer->is_ready() && !cryptographer->has_pending_keys()) { | 2445 if (!cryptographer->is_ready() && !cryptographer->has_pending_keys()) { |
| 2446 if (!nigori.encrypted().blob().empty()) { | 2446 if (!nigori.encrypted().blob().empty()) { |
| 2447 DCHECK(!cryptographer->CanDecrypt(nigori.encrypted())); | 2447 DCHECK(!cryptographer->CanDecrypt(nigori.encrypted())); |
| 2448 cryptographer->SetPendingKeys(nigori.encrypted()); | 2448 cryptographer->SetPendingKeys(nigori.encrypted()); |
| 2449 } | 2449 } |
| 2450 } | 2450 } |
| 2451 | 2451 |
| 2452 // If we've completed a sync cycle and the cryptographer isn't ready | 2452 // If we've completed a sync cycle and the cryptographer isn't ready |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2822 | 2822 |
| 2823 void SyncManager::TriggerOnIncomingNotificationForTest( | 2823 void SyncManager::TriggerOnIncomingNotificationForTest( |
| 2824 const syncable::ModelTypeBitSet& model_types) { | 2824 const syncable::ModelTypeBitSet& model_types) { |
| 2825 IncomingNotificationData notification_data; | 2825 IncomingNotificationData notification_data; |
| 2826 notification_data.service_url = model_types.to_string(); | 2826 notification_data.service_url = model_types.to_string(); |
| 2827 // Here we rely on the default notification method being SERVER. | 2827 // Here we rely on the default notification method being SERVER. |
| 2828 data_->OnIncomingNotification(notification_data); | 2828 data_->OnIncomingNotification(notification_data); |
| 2829 } | 2829 } |
| 2830 | 2830 |
| 2831 } // namespace sync_api | 2831 } // namespace sync_api |
| OLD | NEW |