| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // TODO(tim): Investigating bug 121587. | 217 // TODO(tim): Investigating bug 121587. |
| 218 if (model_associator_->GetSyncIdFromChromeId(node->id()) == | 218 if (model_associator_->GetSyncIdFromChromeId(node->id()) == |
| 219 syncer::kInvalidId) { | 219 syncer::kInvalidId) { |
| 220 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 220 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
| 221 "Bookmark id not found in model associator on BookmarkNodeChanged"); | 221 "Bookmark id not found in model associator on BookmarkNodeChanged"); |
| 222 LOG(ERROR) << "Bad id."; | 222 LOG(ERROR) << "Bad id."; |
| 223 } else if (!sync_node.GetEntry()->good()) { | 223 } else if (!sync_node.GetEntry()->good()) { |
| 224 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 224 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
| 225 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed"); | 225 "Could not InitByIdLookup on BookmarkNodeChanged, good() failed"); |
| 226 LOG(ERROR) << "Bad entry."; | 226 LOG(ERROR) << "Bad entry."; |
| 227 } else if (sync_node.GetEntry()->Get(syncable::IS_DEL)) { | 227 } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) { |
| 228 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 228 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
| 229 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true"); | 229 "Could not InitByIdLookup on BookmarkNodeChanged, is_del true"); |
| 230 LOG(ERROR) << "Deleted entry."; | 230 LOG(ERROR) << "Deleted entry."; |
| 231 } else { | 231 } else { |
| 232 syncer::Cryptographer* crypto = trans.GetCryptographer(); | 232 syncer::Cryptographer* crypto = trans.GetCryptographer(); |
| 233 syncable::ModelTypeSet encrypted_types(crypto->GetEncryptedTypes()); | 233 syncable::ModelTypeSet encrypted_types(crypto->GetEncryptedTypes()); |
| 234 const sync_pb::EntitySpecifics& specifics = | 234 const sync_pb::EntitySpecifics& specifics = |
| 235 sync_node.GetEntry()->Get(syncable::SPECIFICS); | 235 sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS); |
| 236 CHECK(specifics.has_encrypted()); | 236 CHECK(specifics.has_encrypted()); |
| 237 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted()); | 237 const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted()); |
| 238 const bool agreement = encrypted_types.Has(syncable::BOOKMARKS); | 238 const bool agreement = encrypted_types.Has(syncable::BOOKMARKS); |
| 239 if (!agreement && !can_decrypt) { | 239 if (!agreement && !can_decrypt) { |
| 240 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 240 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
| 241 "Could not InitByIdLookup on BookmarkNodeChanged, " | 241 "Could not InitByIdLookup on BookmarkNodeChanged, " |
| 242 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt" | 242 " Cryptographer thinks bookmarks not encrypted, and CanDecrypt" |
| 243 " failed."); | 243 " failed."); |
| 244 LOG(ERROR) << "Case 1."; | 244 LOG(ERROR) << "Case 1."; |
| 245 } else if (agreement && can_decrypt) { | 245 } else if (agreement && can_decrypt) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 const BookmarkNode* bookmark_node, | 650 const BookmarkNode* bookmark_node, |
| 651 BookmarkModel* model, | 651 BookmarkModel* model, |
| 652 syncer::WriteNode* sync_node) { | 652 syncer::WriteNode* sync_node) { |
| 653 std::vector<unsigned char> favicon_bytes; | 653 std::vector<unsigned char> favicon_bytes; |
| 654 EncodeFavicon(bookmark_node, model, &favicon_bytes); | 654 EncodeFavicon(bookmark_node, model, &favicon_bytes); |
| 655 if (!favicon_bytes.empty()) | 655 if (!favicon_bytes.empty()) |
| 656 sync_node->SetFaviconBytes(favicon_bytes); | 656 sync_node->SetFaviconBytes(favicon_bytes); |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace browser_sync | 659 } // namespace browser_sync |
| OLD | NEW |