OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/gfx/png_decoder.h" | 7 #include "base/gfx/png_decoder.h" |
8 #include "chrome/browser/bookmarks/bookmark_storage.h" | 8 #include "chrome/browser/bookmarks/bookmark_storage.h" |
9 #include "chrome/browser/history/query_parser.h" | 9 #include "chrome/browser/history/query_parser.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 BookmarkNode* parent, | 333 BookmarkNode* parent, |
334 int index, | 334 int index, |
335 const std::wstring& title) { | 335 const std::wstring& title) { |
336 if (!loaded_ || parent == &root_ || !IsValidIndex(parent, index, true)) { | 336 if (!loaded_ || parent == &root_ || !IsValidIndex(parent, index, true)) { |
337 // Can't add to the root. | 337 // Can't add to the root. |
338 NOTREACHED(); | 338 NOTREACHED(); |
339 return NULL; | 339 return NULL; |
340 } | 340 } |
341 | 341 |
342 BookmarkNode* new_node = new BookmarkNode(this, GURL()); | 342 BookmarkNode* new_node = new BookmarkNode(this, GURL()); |
| 343 new_node->date_group_modified_ = Time::Now(); |
343 new_node->SetTitle(title); | 344 new_node->SetTitle(title); |
344 new_node->type_ = history::StarredEntry::USER_GROUP; | 345 new_node->type_ = history::StarredEntry::USER_GROUP; |
345 | 346 |
346 return AddNode(parent, index, new_node, false); | 347 return AddNode(parent, index, new_node, false); |
347 } | 348 } |
348 | 349 |
349 BookmarkNode* BookmarkModel::AddURL(BookmarkNode* parent, | 350 BookmarkNode* BookmarkModel::AddURL(BookmarkNode* parent, |
350 int index, | 351 int index, |
351 const std::wstring& title, | 352 const std::wstring& title, |
352 const GURL& url) { | 353 const GURL& url) { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } | 773 } |
773 | 774 |
774 void BookmarkModel::PopulateNodesByURL(BookmarkNode* node) { | 775 void BookmarkModel::PopulateNodesByURL(BookmarkNode* node) { |
775 // NOTE: this is called with url_lock_ already held. As such, this doesn't | 776 // NOTE: this is called with url_lock_ already held. As such, this doesn't |
776 // explicitly grab the lock. | 777 // explicitly grab the lock. |
777 if (node->is_url()) | 778 if (node->is_url()) |
778 nodes_ordered_by_url_set_.insert(node); | 779 nodes_ordered_by_url_set_.insert(node); |
779 for (int i = 0; i < node->GetChildCount(); ++i) | 780 for (int i = 0; i < node->GetChildCount(); ++i) |
780 PopulateNodesByURL(node->GetChild(i)); | 781 PopulateNodesByURL(node->GetChild(i)); |
781 } | 782 } |
OLD | NEW |