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

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

Issue 8396022: [Sync] Add HasChildren() function and use it instead of GetFirstChildId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void BookmarkChangeProcessor::RemoveOneSyncNode( 85 void BookmarkChangeProcessor::RemoveOneSyncNode(
86 sync_api::WriteTransaction* trans, const BookmarkNode* node) { 86 sync_api::WriteTransaction* trans, const BookmarkNode* node) {
87 sync_api::WriteNode sync_node(trans); 87 sync_api::WriteNode sync_node(trans);
88 if (!model_associator_->InitSyncNodeFromChromeId(node->id(), &sync_node)) { 88 if (!model_associator_->InitSyncNodeFromChromeId(node->id(), &sync_node)) {
89 error_handler()->OnUnrecoverableError(FROM_HERE, std::string()); 89 error_handler()->OnUnrecoverableError(FROM_HERE, std::string());
90 return; 90 return;
91 } 91 }
92 // This node should have no children. 92 // This node should have no children.
93 DCHECK(sync_node.GetFirstChildId() == sync_api::kInvalidId); 93 DCHECK(!sync_node.HasChildren());
94 // Remove association and delete the sync node. 94 // Remove association and delete the sync node.
95 model_associator_->Disassociate(sync_node.GetId()); 95 model_associator_->Disassociate(sync_node.GetId());
96 sync_node.Remove(); 96 sync_node.Remove();
97 } 97 }
98 98
99 void BookmarkChangeProcessor::RemoveSyncNodeHierarchy( 99 void BookmarkChangeProcessor::RemoveSyncNodeHierarchy(
100 const BookmarkNode* topmost) { 100 const BookmarkNode* topmost) {
101 sync_api::WriteTransaction trans(FROM_HERE, share_handle()); 101 sync_api::WriteTransaction trans(FROM_HERE, share_handle());
102 102
103 // Later logic assumes that |topmost| has been unlinked. 103 // Later logic assumes that |topmost| has been unlinked.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 const BookmarkNode* bookmark_node, 562 const BookmarkNode* bookmark_node,
563 BookmarkModel* model, 563 BookmarkModel* model,
564 sync_api::WriteNode* sync_node) { 564 sync_api::WriteNode* sync_node) {
565 std::vector<unsigned char> favicon_bytes; 565 std::vector<unsigned char> favicon_bytes;
566 EncodeFavicon(bookmark_node, model, &favicon_bytes); 566 EncodeFavicon(bookmark_node, model, &favicon_bytes);
567 if (!favicon_bytes.empty()) 567 if (!favicon_bytes.empty())
568 sync_node->SetFaviconBytes(favicon_bytes); 568 sync_node->SetFaviconBytes(favicon_bytes);
569 } 569 }
570 570
571 } // namespace browser_sync 571 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/autofill_model_associator.cc ('k') | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698