OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/bookmark_change_processor.h" | 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } else if (!sync_node.GetEntry()->good()) { | 225 } else if (!sync_node.GetEntry()->good()) { |
226 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 226 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
227 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed"); | 227 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed"); |
228 LOG(ERROR) << "Bad entry."; | 228 LOG(ERROR) << "Bad entry."; |
229 } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) { | 229 } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) { |
230 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 230 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
231 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true"); | 231 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true"); |
232 LOG(ERROR) << "Deleted entry."; | 232 LOG(ERROR) << "Deleted entry."; |
233 } else { | 233 } else { |
234 syncer::Cryptographer* crypto = trans.GetCryptographer(); | 234 syncer::Cryptographer* crypto = trans.GetCryptographer(); |
235 syncer::ModelTypeSet encrypted_types(crypto->GetEncryptedTypes()); | 235 syncer::ModelTypeSet encrypted_types(trans.GetEncryptedTypes()); |
236 const sync_pb::EntitySpecifics& specifics = | 236 const sync_pb::EntitySpecifics& specifics = |
237 sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS); | 237 sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS); |
238 CHECK(specifics.has_encrypted()); | 238 CHECK(specifics.has_encrypted()); |
239 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted()); | 239 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted()); |
240 const bool agreement = encrypted_types.Has(syncer::BOOKMARKS); | 240 const bool agreement = encrypted_types.Has(syncer::BOOKMARKS); |
241 if (!agreement && !can_decrypt) { | 241 if (!agreement && !can_decrypt) { |
242 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 242 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
243 "Could not InitByIdLookup on BookmarkNodeChanged, " | 243 "Could not InitByIdLookup on BookmarkNodeChanged, " |
244 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt" | 244 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt" |
245 " failed."); | 245 " failed."); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 const BookmarkNode* bookmark_node, | 652 const BookmarkNode* bookmark_node, |
653 BookmarkModel* model, | 653 BookmarkModel* model, |
654 syncer::WriteNode* sync_node) { | 654 syncer::WriteNode* sync_node) { |
655 std::vector<unsigned char> favicon_bytes; | 655 std::vector<unsigned char> favicon_bytes; |
656 EncodeFavicon(bookmark_node, model, &favicon_bytes); | 656 EncodeFavicon(bookmark_node, model, &favicon_bytes); |
657 if (!favicon_bytes.empty()) | 657 if (!favicon_bytes.empty()) |
658 sync_node->SetFaviconBytes(favicon_bytes); | 658 sync_node->SetFaviconBytes(favicon_bytes); |
659 } | 659 } |
660 | 660 |
661 } // namespace browser_sync | 661 } // namespace browser_sync |
OLD | NEW |