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

Unified Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 7530024: bookmarks: Simplify is_permanent_node() implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use is_root_node Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bookmarks/bookmark_model.cc
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index ae85f96c2a2a087c5f8e4dcd641dcc94568d28ae..4e6ec4685d64ebd036eecdcaa5957709fed37b7c 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -194,7 +194,7 @@ void BookmarkModel::EndImportMode() {
}
void BookmarkModel::Remove(const BookmarkNode* parent, int index) {
- if (!loaded_ || !IsValidIndex(parent, index, false) || is_root(parent)) {
+ if (!loaded_ || !IsValidIndex(parent, index, false) || is_root_node(parent)) {
NOTREACHED();
return;
}
@@ -205,7 +205,7 @@ void BookmarkModel::Move(const BookmarkNode* node,
const BookmarkNode* new_parent,
int index) {
if (!loaded_ || !node || !IsValidIndex(new_parent, index, true) ||
- is_root(new_parent) || is_permanent_node(node)) {
+ is_root_node(new_parent) || is_permanent_node(node)) {
NOTREACHED();
return;
}
@@ -244,7 +244,7 @@ void BookmarkModel::Copy(const BookmarkNode* node,
const BookmarkNode* new_parent,
int index) {
if (!loaded_ || !node || !IsValidIndex(new_parent, index, true) ||
- is_root(new_parent) || is_permanent_node(node)) {
+ is_root_node(new_parent) || is_permanent_node(node)) {
NOTREACHED();
return;
}
@@ -400,7 +400,7 @@ const BookmarkNode* BookmarkModel::GetNodeByID(int64 id) {
const BookmarkNode* BookmarkModel::AddFolder(const BookmarkNode* parent,
int index,
const string16& title) {
- if (!loaded_ || parent == &root_ || !IsValidIndex(parent, index, true)) {
+ if (!loaded_ || is_root_node(parent) || !IsValidIndex(parent, index, true)) {
// Can't add to the root.
NOTREACHED();
return NULL;
@@ -427,7 +427,7 @@ const BookmarkNode* BookmarkModel::AddURLWithCreationTime(
const string16& title,
const GURL& url,
const Time& creation_time) {
- if (!loaded_ || !url.is_valid() || is_root(parent) ||
+ if (!loaded_ || !url.is_valid() || is_root_node(parent) ||
!IsValidIndex(parent, index, true)) {
NOTREACHED();
return NULL;
@@ -452,7 +452,7 @@ const BookmarkNode* BookmarkModel::AddURLWithCreationTime(
}
void BookmarkModel::SortChildren(const BookmarkNode* parent) {
- if (!parent || !parent->is_folder() || is_root(parent) ||
+ if (!parent || !parent->is_folder() || is_root_node(parent) ||
parent->child_count() <= 1) {
return;
}
@@ -832,5 +832,5 @@ BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() {
BookmarkNode* other_node = CreatePermanentNode(BookmarkNode::OTHER_NODE);
BookmarkNode* synced_node = CreatePermanentNode(BookmarkNode::SYNCED);
return new BookmarkLoadDetails(bb_node, other_node, synced_node,
- new BookmarkIndex(profile()), next_node_id_);
+ new BookmarkIndex(profile_), next_node_id_);
}
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698