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

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

Issue 8404022: Fix yet another crash with bookmarks drag&drop on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (!last_url || *url != *last_url) 413 if (!last_url || *url != *last_url)
414 urls->push_back(*url); 414 urls->push_back(*url);
415 last_url = url; 415 last_url = url;
416 } 416 }
417 } 417 }
418 418
419 void BookmarkModel::BlockTillLoaded() { 419 void BookmarkModel::BlockTillLoaded() {
420 loaded_signal_.Wait(); 420 loaded_signal_.Wait();
421 } 421 }
422 422
423 const BookmarkNode* BookmarkModel::GetNodeByID(int64 id) { 423 const BookmarkNode* BookmarkModel::GetNodeByID(int64 id) const {
424 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. 424 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate.
425 return GetNodeByID(&root_, id); 425 return GetNodeByID(&root_, id);
426 } 426 }
427 427
428 const BookmarkNode* BookmarkModel::AddFolder(const BookmarkNode* parent, 428 const BookmarkNode* BookmarkModel::AddFolder(const BookmarkNode* parent,
429 int index, 429 int index,
430 const string16& title) { 430 const string16& title) {
431 if (!loaded_ || is_root_node(parent) || !IsValidIndex(parent, index, true)) { 431 if (!loaded_ || is_root_node(parent) || !IsValidIndex(parent, index, true)) {
432 // Can't add to the root. 432 // Can't add to the root.
433 NOTREACHED(); 433 NOTREACHED();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 details.changed_urls.insert(node->url()); 692 details.changed_urls.insert(node->url());
693 content::NotificationService::current()->Notify( 693 content::NotificationService::current()->Notify(
694 chrome::NOTIFICATION_URLS_STARRED, 694 chrome::NOTIFICATION_URLS_STARRED,
695 content::Source<Profile>(profile_), 695 content::Source<Profile>(profile_),
696 content::Details<history::URLsStarredDetails>(&details)); 696 content::Details<history::URLsStarredDetails>(&details));
697 } 697 }
698 return node; 698 return node;
699 } 699 }
700 700
701 const BookmarkNode* BookmarkModel::GetNodeByID(const BookmarkNode* node, 701 const BookmarkNode* BookmarkModel::GetNodeByID(const BookmarkNode* node,
702 int64 id) { 702 int64 id) const {
703 if (node->id() == id) 703 if (node->id() == id)
704 return node; 704 return node;
705 705
706 for (int i = 0, child_count = node->child_count(); i < child_count; ++i) { 706 for (int i = 0, child_count = node->child_count(); i < child_count; ++i) {
707 const BookmarkNode* result = GetNodeByID(node->GetChild(i), id); 707 const BookmarkNode* result = GetNodeByID(node->GetChild(i), id);
708 if (result) 708 if (result)
709 return result; 709 return result;
710 } 710 }
711 return NULL; 711 return NULL;
712 } 712 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 file_changed_ = true; 833 file_changed_ = true;
834 } 834 }
835 835
836 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { 836 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() {
837 BookmarkNode* bb_node = CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); 837 BookmarkNode* bb_node = CreatePermanentNode(BookmarkNode::BOOKMARK_BAR);
838 BookmarkNode* other_node = CreatePermanentNode(BookmarkNode::OTHER_NODE); 838 BookmarkNode* other_node = CreatePermanentNode(BookmarkNode::OTHER_NODE);
839 BookmarkNode* synced_node = CreatePermanentNode(BookmarkNode::SYNCED); 839 BookmarkNode* synced_node = CreatePermanentNode(BookmarkNode::SYNCED);
840 return new BookmarkLoadDetails(bb_node, other_node, synced_node, 840 return new BookmarkLoadDetails(bb_node, other_node, synced_node,
841 new BookmarkIndex(profile_), next_node_id_); 841 new BookmarkIndex(profile_), next_node_id_);
842 } 842 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698