| OLD | NEW |
| 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_change_processor.h" | 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // before the move. Since deletions in the bookmark model propagate from | 542 // before the move. Since deletions in the bookmark model propagate from |
| 543 // parent to child, we must move them to a temporary location. | 543 // parent to child, we must move them to a temporary location. |
| 544 BookmarkModel* model = bookmark_model_; | 544 BookmarkModel* model = bookmark_model_; |
| 545 | 545 |
| 546 // We are going to make changes to the bookmarks model, but don't want to end | 546 // We are going to make changes to the bookmarks model, but don't want to end |
| 547 // up in a feedback loop, so remove ourselves as an observer while applying | 547 // up in a feedback loop, so remove ourselves as an observer while applying |
| 548 // changes. | 548 // changes. |
| 549 model->RemoveObserver(this); | 549 model->RemoveObserver(this); |
| 550 | 550 |
| 551 // Changes made to the bookmark model due to sync should not be undoable. | 551 // Changes made to the bookmark model due to sync should not be undoable. |
| 552 ScopedSuspendBookmarkUndo suspend_undo(profile_); | 552 ScopedSuspendBookmarkUndo suspend_undo( |
| 553 BookmarkUndoServiceFactory::GetForProfileIfExists(profile_)); |
| 553 | 554 |
| 554 // Notify UI intensive observers of BookmarkModel that we are about to make | 555 // Notify UI intensive observers of BookmarkModel that we are about to make |
| 555 // potentially significant changes to it, so the updates may be batched. For | 556 // potentially significant changes to it, so the updates may be batched. For |
| 556 // example, on Mac, the bookmarks bar displays animations when bookmark items | 557 // example, on Mac, the bookmarks bar displays animations when bookmark items |
| 557 // are added or deleted. | 558 // are added or deleted. |
| 558 model->BeginExtensiveChanges(); | 559 model->BeginExtensiveChanges(); |
| 559 | 560 |
| 560 // A parent to hold nodes temporarily orphaned by parent deletion. It is | 561 // A parent to hold nodes temporarily orphaned by parent deletion. It is |
| 561 // created only if it is needed. | 562 // created only if it is needed. |
| 562 const BookmarkNode* foster_parent = NULL; | 563 const BookmarkNode* foster_parent = NULL; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); | 938 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); |
| 938 sync_node->SetBookmarkSpecifics(updated_specifics); | 939 sync_node->SetBookmarkSpecifics(updated_specifics); |
| 939 } | 940 } |
| 940 } | 941 } |
| 941 | 942 |
| 942 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { | 943 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { |
| 943 return bookmark_model_->client()->CanSyncNode(node); | 944 return bookmark_model_->client()->CanSyncNode(node); |
| 944 } | 945 } |
| 945 | 946 |
| 946 } // namespace browser_sync | 947 } // namespace browser_sync |
| OLD | NEW |