| 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/bookmarks/bookmark_model.h" | 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 const GURL& url, | 461 const GURL& url, |
| 462 const Time& creation_time) { | 462 const Time& creation_time) { |
| 463 if (!loaded_ || !url.is_valid() || is_root_node(parent) || | 463 if (!loaded_ || !url.is_valid() || is_root_node(parent) || |
| 464 !IsValidIndex(parent, index, true)) { | 464 !IsValidIndex(parent, index, true)) { |
| 465 NOTREACHED(); | 465 NOTREACHED(); |
| 466 return NULL; | 466 return NULL; |
| 467 } | 467 } |
| 468 | 468 |
| 469 bool was_bookmarked = IsBookmarked(url); | 469 bool was_bookmarked = IsBookmarked(url); |
| 470 | 470 |
| 471 SetDateFolderModified(parent, creation_time); | 471 // Syncing may result in dates older than the last modified date. |
| 472 if (creation_time > parent->date_folder_modified()) |
| 473 SetDateFolderModified(parent, creation_time); |
| 472 | 474 |
| 473 BookmarkNode* new_node = new BookmarkNode(generate_next_node_id(), url); | 475 BookmarkNode* new_node = new BookmarkNode(generate_next_node_id(), url); |
| 474 new_node->SetTitle(title); | 476 new_node->SetTitle(title); |
| 475 new_node->set_date_added(creation_time); | 477 new_node->set_date_added(creation_time); |
| 476 new_node->set_type(BookmarkNode::URL); | 478 new_node->set_type(BookmarkNode::URL); |
| 477 | 479 |
| 478 { | 480 { |
| 479 // Only hold the lock for the duration of the insert. | 481 // Only hold the lock for the duration of the insert. |
| 480 base::AutoLock url_lock(url_lock_); | 482 base::AutoLock url_lock(url_lock_); |
| 481 nodes_ordered_by_url_set_.insert(new_node); | 483 nodes_ordered_by_url_set_.insert(new_node); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { | 868 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { |
| 867 BookmarkPermanentNode* bb_node = | 869 BookmarkPermanentNode* bb_node = |
| 868 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 870 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
| 869 BookmarkPermanentNode* other_node = | 871 BookmarkPermanentNode* other_node = |
| 870 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 872 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
| 871 BookmarkPermanentNode* mobile_node = | 873 BookmarkPermanentNode* mobile_node = |
| 872 CreatePermanentNode(BookmarkNode::MOBILE); | 874 CreatePermanentNode(BookmarkNode::MOBILE); |
| 873 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 875 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
| 874 new BookmarkIndex(profile_), next_node_id_); | 876 new BookmarkIndex(profile_), next_node_id_); |
| 875 } | 877 } |
| OLD | NEW |