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

Side by Side Diff: chrome/browser/sync/glue/bookmark_model_associator.cc

Issue 319133007: Documented that the new nodes at the root aren't meant to sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/glue/bookmark_change_processor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_model_associator.h" 5 #include "chrome/browser/sync/glue/bookmark_model_associator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 BookmarkNode::BOOKMARK_BAR, 239 BookmarkNode::BOOKMARK_BAR,
240 BookmarkNode::OTHER_NODE, 240 BookmarkNode::OTHER_NODE,
241 BookmarkNode::MOBILE, 241 BookmarkNode::MOBILE,
242 }; 242 };
243 for (size_t i = 0; i < arraysize(bookmark_node_types); ++i) { 243 for (size_t i = 0; i < arraysize(bookmark_node_types); ++i) {
244 int64 id = bookmark_model_->PermanentNode(bookmark_node_types[i])->id(); 244 int64 id = bookmark_model_->PermanentNode(bookmark_node_types[i])->id();
245 bookmark_model_->SetPermanentNodeVisible( 245 bookmark_model_->SetPermanentNodeVisible(
246 bookmark_node_types[i], 246 bookmark_node_types[i],
247 id_map_.find(id) != id_map_.end()); 247 id_map_.find(id) != id_map_.end());
248 } 248 }
249
250 // Note: the root node may have additional extra nodes. Currently their
251 // visibility is not affected by sync.
249 } 252 }
250 253
251 syncer::SyncError BookmarkModelAssociator::DisassociateModels() { 254 syncer::SyncError BookmarkModelAssociator::DisassociateModels() {
252 id_map_.clear(); 255 id_map_.clear();
253 id_map_inverse_.clear(); 256 id_map_inverse_.clear();
254 dirty_associations_sync_ids_.clear(); 257 dirty_associations_sync_ids_.clear();
255 return syncer::SyncError(); 258 return syncer::SyncError();
256 } 259 }
257 260
258 int64 BookmarkModelAssociator::GetSyncIdFromChromeId(const int64& node_id) { 261 int64 BookmarkModelAssociator::GetSyncIdFromChromeId(const int64& node_id) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 459
457 if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(), 460 if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
458 kMobileBookmarksTag) && 461 kMobileBookmarksTag) &&
459 expect_mobile_bookmarks_folder_) { 462 expect_mobile_bookmarks_folder_) {
460 return unrecoverable_error_handler_->CreateAndUploadError( 463 return unrecoverable_error_handler_->CreateAndUploadError(
461 FROM_HERE, 464 FROM_HERE,
462 "Mobile bookmarks node not found", 465 "Mobile bookmarks node not found",
463 model_type()); 466 model_type());
464 } 467 }
465 468
469 // Note: the root node may have additional extra nodes. Currently none of
470 // them are meant to sync.
471
466 int64 bookmark_bar_sync_id = GetSyncIdFromChromeId( 472 int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
467 bookmark_model_->bookmark_bar_node()->id()); 473 bookmark_model_->bookmark_bar_node()->id());
468 DCHECK_NE(bookmark_bar_sync_id, syncer::kInvalidId); 474 DCHECK_NE(bookmark_bar_sync_id, syncer::kInvalidId);
469 int64 other_bookmarks_sync_id = GetSyncIdFromChromeId( 475 int64 other_bookmarks_sync_id = GetSyncIdFromChromeId(
470 bookmark_model_->other_node()->id()); 476 bookmark_model_->other_node()->id());
471 DCHECK_NE(other_bookmarks_sync_id, syncer::kInvalidId); 477 DCHECK_NE(other_bookmarks_sync_id, syncer::kInvalidId);
472 int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId( 478 int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId(
473 bookmark_model_->mobile_node()->id()); 479 bookmark_model_->mobile_node()->id());
474 if (expect_mobile_bookmarks_folder_) { 480 if (expect_mobile_bookmarks_folder_) {
475 DCHECK_NE(syncer::kInvalidId, mobile_bookmarks_sync_id); 481 DCHECK_NE(syncer::kInvalidId, mobile_bookmarks_sync_id);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 if (bk_delete_journals.empty()) 614 if (bk_delete_journals.empty())
609 return 0; 615 return 0;
610 size_t num_journals_unmatched = bk_delete_journals.size(); 616 size_t num_journals_unmatched = bk_delete_journals.size();
611 617
612 // Check bookmark model from top to bottom. 618 // Check bookmark model from top to bottom.
613 std::stack<const BookmarkNode*> dfs_stack; 619 std::stack<const BookmarkNode*> dfs_stack;
614 dfs_stack.push(bookmark_model_->bookmark_bar_node()); 620 dfs_stack.push(bookmark_model_->bookmark_bar_node());
615 dfs_stack.push(bookmark_model_->other_node()); 621 dfs_stack.push(bookmark_model_->other_node());
616 if (expect_mobile_bookmarks_folder_) 622 if (expect_mobile_bookmarks_folder_)
617 dfs_stack.push(bookmark_model_->mobile_node()); 623 dfs_stack.push(bookmark_model_->mobile_node());
624 // Note: the root node may have additional extra nodes. Currently none of
625 // them are meant to sync.
618 626
619 // Remember folders that match delete journals in first pass but don't delete 627 // Remember folders that match delete journals in first pass but don't delete
620 // them in case there are bookmarks left under them. After non-folder 628 // them in case there are bookmarks left under them. After non-folder
621 // bookmarks are removed in first pass, recheck the folders in reverse order 629 // bookmarks are removed in first pass, recheck the folders in reverse order
622 // to remove empty ones. 630 // to remove empty ones.
623 FolderInfoList folders_matched; 631 FolderInfoList folders_matched;
624 while (!dfs_stack.empty()) { 632 while (!dfs_stack.empty()) {
625 const BookmarkNode* parent = dfs_stack.top(); 633 const BookmarkNode* parent = dfs_stack.top();
626 dfs_stack.pop(); 634 dfs_stack.pop();
627 635
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 syncer::SyncError::PERSISTENCE_ERROR, 783 syncer::SyncError::PERSISTENCE_ERROR,
776 message, 784 message,
777 syncer::BOOKMARKS); 785 syncer::BOOKMARKS);
778 } 786 }
779 } 787 }
780 } 788 }
781 return syncer::SyncError(); 789 return syncer::SyncError();
782 } 790 }
783 791
784 } // namespace browser_sync 792 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bookmark_change_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698