| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 UpdateTransactionVersion(new_version, model, | 405 UpdateTransactionVersion(new_version, model, |
| 406 std::vector<const BookmarkNode*>(1, child)); | 406 std::vector<const BookmarkNode*>(1, child)); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void BookmarkChangeProcessor::BookmarkNodeFaviconChanged( | 409 void BookmarkChangeProcessor::BookmarkNodeFaviconChanged( |
| 410 BookmarkModel* model, | 410 BookmarkModel* model, |
| 411 const BookmarkNode* node) { | 411 const BookmarkNode* node) { |
| 412 if (!CanSyncNode(node)) { |
| 413 return; |
| 414 } |
| 415 |
| 416 // We shouldn't see changes to the top-level nodes. |
| 417 if (model->is_permanent_node(node)) { |
| 418 NOTREACHED() << "Saw Favicon update to permanent node!"; |
| 419 return; |
| 420 } |
| 421 |
| 422 // Ignore changes with empty images. This can happen if the favicon is |
| 423 // still being loaded. |
| 424 const gfx::Image& favicon = model->GetFavicon(node); |
| 425 if (favicon.IsEmpty()) { |
| 426 return; |
| 427 } |
| 428 |
| 412 BookmarkNodeChanged(model, node); | 429 BookmarkNodeChanged(model, node); |
| 413 } | 430 } |
| 414 | 431 |
| 415 void BookmarkChangeProcessor::BookmarkNodeChildrenReordered( | 432 void BookmarkChangeProcessor::BookmarkNodeChildrenReordered( |
| 416 BookmarkModel* model, const BookmarkNode* node) { | 433 BookmarkModel* model, const BookmarkNode* node) { |
| 417 if (!CanSyncNode(node)) | 434 if (!CanSyncNode(node)) |
| 418 return; | 435 return; |
| 419 int64 new_version = syncer::syncable::kInvalidTransactionVersion; | 436 int64 new_version = syncer::syncable::kInvalidTransactionVersion; |
| 420 std::vector<const BookmarkNode*> children; | 437 std::vector<const BookmarkNode*> children; |
| 421 { | 438 { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); | 904 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); |
| 888 sync_node->SetBookmarkSpecifics(updated_specifics); | 905 sync_node->SetBookmarkSpecifics(updated_specifics); |
| 889 } | 906 } |
| 890 } | 907 } |
| 891 | 908 |
| 892 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { | 909 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { |
| 893 return bookmark_model_->client()->CanSyncNode(node); | 910 return bookmark_model_->client()->CanSyncNode(node); |
| 894 } | 911 } |
| 895 | 912 |
| 896 } // namespace browser_sync | 913 } // namespace browser_sync |
| OLD | NEW |