Commit d4cbf04a authored by sky@chromium.org's avatar sky@chromium.org

Changes BookmarkModelAssociator not to fail if mobile folder doesn't

exist. This is a regression from
http://codereview.chromium.org/8759017

BUG=106238
TEST=none
R=akalin@chromium.org,yfriedman@chromium.org


Review URL: http://codereview.chromium.org/8790008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112851 0039d316-1c4b-4281-b951-d872f2087c98
parent 62a39f15
...@@ -368,11 +368,10 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) { ...@@ -368,11 +368,10 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) {
error->Reset(FROM_HERE, kServerError, model_type()); error->Reset(FROM_HERE, kServerError, model_type());
return false; return false;
} }
if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(), // The mobile folder isn't always present on the backend, so we don't fail if
kMobileBookmarksTag)) { // it doesn't exist.
error->Reset(FROM_HERE, kServerError, model_type()); ignore_result(AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
return false; kMobileBookmarksTag));
}
int64 bookmark_bar_sync_id = GetSyncIdFromChromeId( int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
bookmark_model_->bookmark_bar_node()->id()); bookmark_model_->bookmark_bar_node()->id());
DCHECK_NE(bookmark_bar_sync_id, sync_api::kInvalidId); DCHECK_NE(bookmark_bar_sync_id, sync_api::kInvalidId);
...@@ -381,7 +380,6 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) { ...@@ -381,7 +380,6 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) {
DCHECK_NE(other_bookmarks_sync_id, sync_api::kInvalidId); DCHECK_NE(other_bookmarks_sync_id, sync_api::kInvalidId);
int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId( int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId(
bookmark_model_->mobile_node()->id()); bookmark_model_->mobile_node()->id());
DCHECK_NE(mobile_bookmarks_sync_id, sync_api::kInvalidId);
std::stack<int64> dfs_stack; std::stack<int64> dfs_stack;
if (mobile_bookmarks_sync_id != sync_api::kInvalidId) if (mobile_bookmarks_sync_id != sync_api::kInvalidId)
...@@ -525,10 +523,9 @@ bool BookmarkModelAssociator::LoadAssociations() { ...@@ -525,10 +523,9 @@ bool BookmarkModelAssociator::LoadAssociations() {
return false; return false;
} }
int64 mobile_bookmarks_id = -1; int64 mobile_bookmarks_id = -1;
if (!GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id)) { // Can't fail here as the mobile folder may not exist.
// We should always be able to find the permanent nodes. ignore_result(
return false; GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id));
}
// Build a bookmark node ID index since we are going to repeatedly search for // Build a bookmark node ID index since we are going to repeatedly search for
// bookmark nodes by their IDs. // bookmark nodes by their IDs.
...@@ -538,7 +535,8 @@ bool BookmarkModelAssociator::LoadAssociations() { ...@@ -538,7 +535,8 @@ bool BookmarkModelAssociator::LoadAssociations() {
id_index.AddAll(bookmark_model_->mobile_node()); id_index.AddAll(bookmark_model_->mobile_node());
std::stack<int64> dfs_stack; std::stack<int64> dfs_stack;
dfs_stack.push(mobile_bookmarks_id); if (mobile_bookmarks_id != -1)
dfs_stack.push(mobile_bookmarks_id);
dfs_stack.push(other_bookmarks_id); dfs_stack.push(other_bookmarks_id);
dfs_stack.push(bookmark_bar_id); dfs_stack.push(bookmark_bar_id);
......
...@@ -116,7 +116,7 @@ class BookmarkModelAssociator ...@@ -116,7 +116,7 @@ class BookmarkModelAssociator
// user's share. For example, "other_bookmarks" is the tag for the Other // user's share. For example, "other_bookmarks" is the tag for the Other
// Bookmarks folder. The sync nodes are server-created. // Bookmarks folder. The sync nodes are server-created.
bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node,
const std::string& tag); const std::string& tag) WARN_UNUSED_RESULT;
// Compare the properties of a pair of nodes from either domain. // Compare the properties of a pair of nodes from either domain.
bool NodesMatch(const BookmarkNode* bookmark, bool NodesMatch(const BookmarkNode* bookmark,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment