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

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

Issue 265853002: Allow embedder to force visibility of permanent nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase & fix BookmarkModelTest.NodeVisibility Created 6 years, 7 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
Index: chrome/browser/sync/glue/bookmark_model_associator.cc
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc
index 2ed2847aeb83a28c8ed7cc63bcb8be25c4934c54..a51a4711cf76fcc2afd89a395f5cb62fdd29e945 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.cc
+++ b/chrome/browser/sync/glue/bookmark_model_associator.cc
@@ -11,6 +11,7 @@
#include "base/containers/hash_tables.h"
#include "base/format_macros.h"
#include "base/location.h"
+#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -21,6 +22,7 @@
#include "chrome/browser/undo/bookmark_undo_service.h"
#include "chrome/browser/undo/bookmark_undo_service_factory.h"
#include "chrome/browser/undo/bookmark_undo_utils.h"
+#include "components/bookmarks/core/browser/bookmark_client.h"
#include "components/bookmarks/core/browser/bookmark_model.h"
#include "content/public/browser/browser_thread.h"
#include "sync/api/sync_error.h"
@@ -233,9 +235,17 @@ void BookmarkModelAssociator::UpdatePermanentNodeVisibility() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(bookmark_model_->loaded());
- bookmark_model_->SetPermanentNodeVisible(
- BookmarkNode::MOBILE,
- id_map_.find(bookmark_model_->mobile_node()->id()) != id_map_.end());
+ BookmarkNode::Type bookmark_node_types[] = {
+ BookmarkNode::BOOKMARK_BAR,
+ BookmarkNode::OTHER_NODE,
+ BookmarkNode::MOBILE,
+ };
+ for (size_t i = 0; i < arraysize(bookmark_node_types); ++i) {
+ int64 id = bookmark_model_->PermanentNode(bookmark_node_types[i])->id();
+ bookmark_model_->SetPermanentNodeVisible(
+ bookmark_node_types[i],
+ id_map_.find(id) != id_map_.end());
+ }
}
syncer::SyncError BookmarkModelAssociator::DisassociateModels() {
« no previous file with comments | « chrome/browser/bookmarks/chrome_bookmark_client.cc ('k') | components/bookmarks/core/browser/bookmark_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698