OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return unrecoverable_error_handler_->CreateAndUploadError( | 465 return unrecoverable_error_handler_->CreateAndUploadError( |
466 FROM_HERE, | 466 FROM_HERE, |
467 "Failed to lookup node.", | 467 "Failed to lookup node.", |
468 model_type()); | 468 model_type()); |
469 } | 469 } |
470 | 470 |
471 const BookmarkNode* child_node = NULL; | 471 const BookmarkNode* child_node = NULL; |
472 child_node = node_finder.FindBookmarkNode(sync_child_node); | 472 child_node = node_finder.FindBookmarkNode(sync_child_node); |
473 if (child_node) { | 473 if (child_node) { |
474 bookmark_model_->Move(child_node, parent_node, index); | 474 bookmark_model_->Move(child_node, parent_node, index); |
475 // Set the favicon for bookmark node from sync node or vice versa. | 475 // Set the favicon for bookmark node from the sync node. |
476 if (BookmarkChangeProcessor::SetBookmarkFavicon( | 476 BookmarkChangeProcessor::SetBookmarkFavicon( |
477 &sync_child_node, child_node, bookmark_model_)) { | 477 &sync_child_node, child_node, bookmark_model_); |
478 BookmarkChangeProcessor::SetSyncNodeFavicon( | |
479 child_node, bookmark_model_, &sync_child_node); | |
480 } | |
481 } else { | 478 } else { |
482 // Create a new bookmark node for the sync node. | 479 // Create a new bookmark node for the sync node. |
483 child_node = BookmarkChangeProcessor::CreateBookmarkNode( | 480 child_node = BookmarkChangeProcessor::CreateBookmarkNode( |
484 &sync_child_node, parent_node, bookmark_model_, index); | 481 &sync_child_node, parent_node, bookmark_model_, index); |
485 if (!child_node) { | 482 if (!child_node) { |
486 // This can happen if a sync bookmark node doesn't have a valid url. | 483 // This can happen if a sync bookmark node doesn't have a valid url. |
487 // As far as we can tell, it appears this can only happen if something | 484 // As far as we can tell, it appears this can only happen if something |
488 // interrupts association. For now, we just ignore the bookmark. | 485 // interrupts association. For now, we just ignore the bookmark. |
489 LOG(ERROR) << "Failed to create bookmark node with title " | 486 LOG(ERROR) << "Failed to create bookmark node with title " |
490 << sync_child_node.GetTitle() << " and url " | 487 << sync_child_node.GetTitle() << " and url " |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 660 |
664 bool BookmarkModelAssociator::CryptoReadyIfNecessary() { | 661 bool BookmarkModelAssociator::CryptoReadyIfNecessary() { |
665 // We only access the cryptographer while holding a transaction. | 662 // We only access the cryptographer while holding a transaction. |
666 syncer::ReadTransaction trans(FROM_HERE, user_share_); | 663 syncer::ReadTransaction trans(FROM_HERE, user_share_); |
667 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); | 664 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); |
668 return !encrypted_types.Has(syncer::BOOKMARKS) || | 665 return !encrypted_types.Has(syncer::BOOKMARKS) || |
669 trans.GetCryptographer()->is_ready(); | 666 trans.GetCryptographer()->is_ready(); |
670 } | 667 } |
671 | 668 |
672 } // namespace browser_sync | 669 } // namespace browser_sync |
OLD | NEW |