OLD | NEW |
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_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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 sync_api::ReadNode synced_bookmarks_node(&trans); | 270 sync_api::ReadNode synced_bookmarks_node(&trans); |
271 if (has_synced_folder && | 271 if (has_synced_folder && |
272 !synced_bookmarks_node.InitByIdLookup(synced_bookmarks_sync_id)) { | 272 !synced_bookmarks_node.InitByIdLookup(synced_bookmarks_sync_id)) { |
273 return false; | 273 return false; |
274 } | 274 } |
275 | 275 |
276 // Sync model has user created nodes if either one of the permanent nodes | 276 // Sync model has user created nodes if either one of the permanent nodes |
277 // has children. | 277 // has children. |
278 *has_nodes = bookmark_bar_node.GetFirstChildId() != sync_api::kInvalidId || | 278 *has_nodes = bookmark_bar_node.HasChildren() || |
279 other_bookmarks_node.GetFirstChildId() != sync_api::kInvalidId || | 279 other_bookmarks_node.HasChildren() || |
280 (has_synced_folder && | 280 (has_synced_folder && synced_bookmarks_node.HasChildren()); |
281 synced_bookmarks_node.GetFirstChildId() != sync_api::kInvalidId); | |
282 return true; | 281 return true; |
283 } | 282 } |
284 | 283 |
285 bool BookmarkModelAssociator::NodesMatch( | 284 bool BookmarkModelAssociator::NodesMatch( |
286 const BookmarkNode* bookmark, | 285 const BookmarkNode* bookmark, |
287 const sync_api::BaseNode* sync_node) const { | 286 const sync_api::BaseNode* sync_node) const { |
288 if (bookmark->GetTitle() != UTF8ToUTF16(sync_node->GetTitle())) | 287 if (bookmark->GetTitle() != UTF8ToUTF16(sync_node->GetTitle())) |
289 return false; | 288 return false; |
290 if (bookmark->is_folder() != sync_node->GetIsFolder()) | 289 if (bookmark->is_folder() != sync_node->GetIsFolder()) |
291 return false; | 290 return false; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 bool BookmarkModelAssociator::CryptoReadyIfNecessary() { | 607 bool BookmarkModelAssociator::CryptoReadyIfNecessary() { |
609 // We only access the cryptographer while holding a transaction. | 608 // We only access the cryptographer while holding a transaction. |
610 sync_api::ReadTransaction trans(FROM_HERE, user_share_); | 609 sync_api::ReadTransaction trans(FROM_HERE, user_share_); |
611 const syncable::ModelTypeSet& encrypted_types = | 610 const syncable::ModelTypeSet& encrypted_types = |
612 sync_api::GetEncryptedTypes(&trans); | 611 sync_api::GetEncryptedTypes(&trans); |
613 return encrypted_types.count(syncable::BOOKMARKS) == 0 || | 612 return encrypted_types.count(syncable::BOOKMARKS) == 0 || |
614 trans.GetCryptographer()->is_ready(); | 613 trans.GetCryptographer()->is_ready(); |
615 } | 614 } |
616 | 615 |
617 } // namespace browser_sync | 616 } // namespace browser_sync |
OLD | NEW |