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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 NOTREACHED(); | 303 NOTREACHED(); |
304 return; | 304 return; |
305 } | 305 } |
306 | 306 |
307 if (new_parent->HasAncestor(node)) { | 307 if (new_parent->HasAncestor(node)) { |
308 // Can't make an ancestor of the node be a child of the node. | 308 // Can't make an ancestor of the node be a child of the node. |
309 NOTREACHED(); | 309 NOTREACHED(); |
310 return; | 310 return; |
311 } | 311 } |
312 | 312 |
313 SetDateFolderModified(new_parent, Time::Now()); | |
314 | |
315 const BookmarkNode* old_parent = node->parent(); | 313 const BookmarkNode* old_parent = node->parent(); |
316 int old_index = old_parent->GetIndexOf(node); | 314 int old_index = old_parent->GetIndexOf(node); |
317 | 315 |
318 if (old_parent == new_parent && | 316 if (old_parent == new_parent && |
319 (index == old_index || index == old_index + 1)) { | 317 (index == old_index || index == old_index + 1)) { |
320 // Node is already in this position, nothing to do. | 318 // Node is already in this position, nothing to do. |
321 return; | 319 return; |
322 } | 320 } |
323 | 321 |
| 322 SetDateFolderModified(new_parent, Time::Now()); |
| 323 |
324 if (old_parent == new_parent && index > old_index) | 324 if (old_parent == new_parent && index > old_index) |
325 index--; | 325 index--; |
326 BookmarkNode* mutable_new_parent = AsMutable(new_parent); | 326 BookmarkNode* mutable_new_parent = AsMutable(new_parent); |
327 mutable_new_parent->Add(AsMutable(node), index); | 327 mutable_new_parent->Add(AsMutable(node), index); |
328 | 328 |
329 if (store_.get()) | 329 if (store_.get()) |
330 store_->ScheduleSave(); | 330 store_->ScheduleSave(); |
331 | 331 |
332 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, | 332 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, |
333 BookmarkNodeMoved(this, old_parent, old_index, | 333 BookmarkNodeMoved(this, old_parent, old_index, |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 BookmarkPermanentNode* bb_node = | 979 BookmarkPermanentNode* bb_node = |
980 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 980 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
981 BookmarkPermanentNode* other_node = | 981 BookmarkPermanentNode* other_node = |
982 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 982 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
983 BookmarkPermanentNode* mobile_node = | 983 BookmarkPermanentNode* mobile_node = |
984 CreatePermanentNode(BookmarkNode::MOBILE); | 984 CreatePermanentNode(BookmarkNode::MOBILE); |
985 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 985 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
986 new BookmarkIndex(profile_), | 986 new BookmarkIndex(profile_), |
987 next_node_id_); | 987 next_node_id_); |
988 } | 988 } |
OLD | NEW |