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) {
error->Reset(FROM_HERE, kServerError, model_type());
return false;
}
if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
kMobileBookmarksTag)) {
error->Reset(FROM_HERE, kServerError, model_type());
return false;
}
// The mobile folder isn't always present on the backend, so we don't fail if
// it doesn't exist.
ignore_result(AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
kMobileBookmarksTag));
int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
bookmark_model_->bookmark_bar_node()->id());
DCHECK_NE(bookmark_bar_sync_id, sync_api::kInvalidId);
......@@ -381,7 +380,6 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) {
DCHECK_NE(other_bookmarks_sync_id, sync_api::kInvalidId);
int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId(
bookmark_model_->mobile_node()->id());
DCHECK_NE(mobile_bookmarks_sync_id, sync_api::kInvalidId);
std::stack<int64> dfs_stack;
if (mobile_bookmarks_sync_id != sync_api::kInvalidId)
......@@ -525,10 +523,9 @@ bool BookmarkModelAssociator::LoadAssociations() {
return false;
}
int64 mobile_bookmarks_id = -1;
if (!GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id)) {
// We should always be able to find the permanent nodes.
return false;
}
// Can't fail here as the mobile folder may not exist.
ignore_result(
GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id));
// Build a bookmark node ID index since we are going to repeatedly search for
// bookmark nodes by their IDs.
......@@ -538,7 +535,8 @@ bool BookmarkModelAssociator::LoadAssociations() {
id_index.AddAll(bookmark_model_->mobile_node());
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(bookmark_bar_id);
......
......@@ -116,7 +116,7 @@ class BookmarkModelAssociator
// user's share. For example, "other_bookmarks" is the tag for the Other
// Bookmarks folder. The sync nodes are server-created.
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.
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