| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_utils.h" | 9 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_storage.h" | 10 #include "chrome/browser/bookmarks/bookmark_storage.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 UErrorCode error = U_ZERO_ERROR; | 335 UErrorCode error = U_ZERO_ERROR; |
| 336 scoped_ptr<Collator> collator( | 336 scoped_ptr<Collator> collator( |
| 337 Collator::createInstance( | 337 Collator::createInstance( |
| 338 Locale(WideToUTF8(g_browser_process->GetApplicationLocale()).c_str()), | 338 Locale(WideToUTF8(g_browser_process->GetApplicationLocale()).c_str()), |
| 339 error)); | 339 error)); |
| 340 if (U_FAILURE(error)) | 340 if (U_FAILURE(error)) |
| 341 collator.reset(NULL); | 341 collator.reset(NULL); |
| 342 std::sort(parent->children().begin(), parent->children().end(), | 342 std::sort(parent->children().begin(), parent->children().end(), |
| 343 SortComparator(collator.get())); | 343 SortComparator(collator.get())); |
| 344 | 344 |
| 345 if (store_.get()) |
| 346 store_->ScheduleSave(); |
| 347 |
| 345 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, | 348 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, |
| 346 BookmarkNodeChildrenReordered(this, parent)); | 349 BookmarkNodeChildrenReordered(this, parent)); |
| 347 } | 350 } |
| 348 | 351 |
| 349 void BookmarkModel::SetURLStarred(const GURL& url, | 352 void BookmarkModel::SetURLStarred(const GURL& url, |
| 350 const std::wstring& title, | 353 const std::wstring& title, |
| 351 bool is_starred) { | 354 bool is_starred) { |
| 352 std::vector<BookmarkNode*> bookmarks; | 355 std::vector<BookmarkNode*> bookmarks; |
| 353 GetNodesByURL(url, &bookmarks); | 356 GetNodesByURL(url, &bookmarks); |
| 354 bool bookmarks_exist = !bookmarks.empty(); | 357 bool bookmarks_exist = !bookmarks.empty(); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 } | 723 } |
| 721 | 724 |
| 722 void BookmarkModel::PopulateNodesByURL(BookmarkNode* node) { | 725 void BookmarkModel::PopulateNodesByURL(BookmarkNode* node) { |
| 723 // NOTE: this is called with url_lock_ already held. As such, this doesn't | 726 // NOTE: this is called with url_lock_ already held. As such, this doesn't |
| 724 // explicitly grab the lock. | 727 // explicitly grab the lock. |
| 725 if (node->is_url()) | 728 if (node->is_url()) |
| 726 nodes_ordered_by_url_set_.insert(node); | 729 nodes_ordered_by_url_set_.insert(node); |
| 727 for (int i = 0; i < node->GetChildCount(); ++i) | 730 for (int i = 0; i < node->GetChildCount(); ++i) |
| 728 PopulateNodesByURL(node->GetChild(i)); | 731 PopulateNodesByURL(node->GetChild(i)); |
| 729 } | 732 } |
| OLD | NEW |