Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 11090083: Makes sync code persist the date the node was added. I'm hoping this covers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698