Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7400)

Unified Diff: chrome/browser/sync/glue/bookmark_change_processor.cc

Issue 10694126: Revert 146032 - [Sync] Check if bookmark exists before attempting favicon update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/bookmark_change_processor.cc
===================================================================
--- chrome/browser/sync/glue/bookmark_change_processor.cc (revision 146039)
+++ chrome/browser/sync/glue/bookmark_change_processor.cc (working copy)
@@ -21,6 +21,7 @@
#include "sync/internal_api/public/read_node.h"
#include "sync/internal_api/public/write_node.h"
#include "sync/internal_api/public/write_transaction.h"
+#include "sync/syncable/entry.h" // TODO(tim): Investigating bug 121587.
#include "ui/gfx/image/image_util.h"
using content::BrowserThread;
@@ -213,8 +214,54 @@
// Lookup the sync node that's associated with |node|.
syncer::WriteNode sync_node(&trans);
if (!model_associator_->InitSyncNodeFromChromeId(node->id(), &sync_node)) {
- error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
- "Failed to load sync node for updated bookmark.");
+ // TODO(tim): Investigating bug 121587.
+ if (model_associator_->GetSyncIdFromChromeId(node->id()) ==
+ syncer::kInvalidId) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Bookmark id not found in model associator on BookmarkNodeChanged");
+ LOG(ERROR) << "Bad id.";
+ } else if (!sync_node.GetEntry()->good()) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, good() failed");
+ LOG(ERROR) << "Bad entry.";
+ } else if (sync_node.GetEntry()->Get(syncer::syncable::IS_DEL)) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, is_del true");
+ LOG(ERROR) << "Deleted entry.";
+ } else {
+ syncer::Cryptographer* crypto = trans.GetCryptographer();
+ syncer::ModelTypeSet encrypted_types(crypto->GetEncryptedTypes());
+ const sync_pb::EntitySpecifics& specifics =
+ sync_node.GetEntry()->Get(syncer::syncable::SPECIFICS);
+ CHECK(specifics.has_encrypted());
+ const bool can_decrypt = crypto->CanDecrypt(specifics.encrypted());
+ const bool agreement = encrypted_types.Has(syncer::BOOKMARKS);
+ if (!agreement && !can_decrypt) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, "
+ " Cryptographer thinks bookmarks not encrypted, and CanDecrypt"
+ " failed.");
+ LOG(ERROR) << "Case 1.";
+ } else if (agreement && can_decrypt) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, "
+ " Cryptographer thinks bookmarks are encrypted, and CanDecrypt"
+ " succeeded (?!), but DecryptIfNecessary failed.");
+ LOG(ERROR) << "Case 2.";
+ } else if (agreement) {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, "
+ " Cryptographer thinks bookmarks are encrypted, but CanDecrypt"
+ " failed.");
+ LOG(ERROR) << "Case 3.";
+ } else {
+ error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE,
+ "Could not InitByIdLookup on BookmarkNodeChanged, "
+ " Cryptographer thinks bookmarks not encrypted, but CanDecrypt"
+ " succeeded (super weird, btw)");
+ LOG(ERROR) << "Case 4.";
+ }
+ }
return;
}
@@ -265,13 +312,6 @@
BookmarkModel* model,
const BookmarkNode* node) {
DCHECK(running());
- // Because favicon changes come from a different thread, it's possible we're
- // being notified of a favicon change for a url whose bookmark was recently
- // deleted. Check if we have a sync node for this bookmark, and if not ignore
- // the favicon change.
- if (model_associator_->GetSyncIdFromChromeId(node->id()) ==
- syncer::kInvalidId)
- return;
BookmarkNodeChanged(model, node);
}
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698