diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:17:48 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:17:48 +0000 |
commit | 368f3a7502802277d24d219c2ed0fdac09f36470 (patch) | |
tree | bd877d741c470fa411a53710b3b2f06cc5fa5ae0 /chrome/browser/ui/cocoa/bookmarks | |
parent | 39529b33b5e80e5be1d583dfd43f0d692209cbf3 (diff) | |
download | chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.zip chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.tar.gz chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.tar.bz2 |
Rename IndexOfChild to GetIndexOf. Part 1
This is part of a serie of patches to make the TreeNode more closer to style
used in the Views Tree API (see views/view.h for reference).
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6623037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/cocoa/bookmarks')
5 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index 4e7eda5..e63b645 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -644,7 +644,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { int index = -1; if (node != bookmarkModel_->GetBookmarkBarNode() && !node->is_folder()) { const BookmarkNode* parent = node->GetParent(); - index = parent->IndexOfChild(node) + 1; + index = parent->GetIndexOf(node) + 1; if (index > parent->GetChildCount()) index = -1; node = parent; @@ -657,7 +657,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { const BookmarkNode* node = [self nodeFromMenuItem:sender]; if (node) { bookmarkModel_->Remove(node->GetParent(), - node->GetParent()->IndexOfChild(node)); + node->GetParent()->GetIndexOf(node)); } } @@ -720,7 +720,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { newIndex = parent->GetChildCount(); } else { parent = senderNode->GetParent(); - newIndex = parent->IndexOfChild(senderNode) + 1; + newIndex = parent->GetIndexOf(senderNode) + 1; } BookmarkNameFolderController* controller = [[BookmarkNameFolderController alloc] @@ -1758,7 +1758,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { const BookmarkNode* afterNode = [buttonToTheRightOfDraggedButton bookmarkNode]; DCHECK(afterNode); - int index = afterNode->GetParent()->IndexOfChild(afterNode); + int index = afterNode->GetParent()->GetIndexOf(afterNode); // Make sure we don't get confused by buttons which aren't visible. return std::min(index, displayedButtonCount_); } @@ -2065,7 +2065,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { if (node) { const BookmarkNode* parent = node->GetParent(); bookmarkModel_->Remove(parent, - parent->IndexOfChild(node)); + parent->GetIndexOf(node)); } } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm index a2655d6..0b187ab 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -523,7 +523,7 @@ TEST_F(BookmarkBarControllerTest, NoItemContainerGoesAway) { ASCIIToUTF16("title"), GURL("http://www.google.com")); EXPECT_TRUE([noItemContainer isHidden]); - model->Remove(bar, bar->IndexOfChild(node)); + model->Remove(bar, bar->GetIndexOf(node)); EXPECT_FALSE([noItemContainer isHidden]); // Now try it using a bookmark from the Other Bookmarks. @@ -1526,7 +1526,7 @@ TEST_F(BookmarkBarControllerTest, NodeDeletedWhileMenuIsOpen) { // Now delete the node and make sure things are happy (no crash, // NULL node caught). - model->Remove(parent, parent->IndexOfChild(initialNode)); + model->Remove(parent, parent->GetIndexOf(initialNode)); EXPECT_EQ(nil, [bar_ nodeFromMenuItem:item]); // Should not crash by referencing a deleted node. [bar_ openBookmarkInNewWindow:item]; @@ -1563,7 +1563,7 @@ TEST_F(BookmarkBarControllerTest, NodeDeletedWhileContextMenuIsOpen) { [bar_ setButtonContextMenu:fakeMenu]; // Force a delete which should cancelTracking on the menu. - model->Remove(framma->GetParent(), framma->GetParent()->IndexOfChild(framma)); + model->Remove(framma->GetParent(), framma->GetParent()->GetIndexOf(framma)); // Restore, then confirm cancelTracking was called. [bar_ setButtonContextMenu:origMenu]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm index 9286220..e91db0f 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm @@ -1156,7 +1156,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { bookmarkNode]; DCHECK(beforeNode); // Be careful if the number of buttons != number of nodes. - return ((beforeNode->GetParent()->IndexOfChild(beforeNode) + 1) - + return ((beforeNode->GetParent()->GetIndexOf(beforeNode) + 1) - [[parentButton_ cell] startingChildIndex]); } @@ -1279,7 +1279,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { if (node) { const BookmarkNode* parent = node->GetParent(); [self bookmarkModel]->Remove(parent, - parent->IndexOfChild(node)); + parent->GetIndexOf(node)); } } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm index d357087..85ac568 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm @@ -175,7 +175,7 @@ class BookmarkBarFolderControllerTest : public CocoaTest { void RemoveLongTitleNode() { BookmarkModel* model = helper_.profile()->GetBookmarkModel(); model->Remove(longTitleNode_->GetParent(), - longTitleNode_->GetParent()->IndexOfChild(longTitleNode_)); + longTitleNode_->GetParent()->GetIndexOf(longTitleNode_)); } // Add LOTS of nodes to our model if needed (e.g. scrolling). diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm index be2007b..2fbd889 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -354,7 +354,7 @@ TEST_F(BookmarkEditorControllerTreeTest, RenameBookmarkInPlace) { UpdateBB3(); const BookmarkNode* newParent = bookmark_bb_3_->GetParent(); ASSERT_EQ(newParent, oldParent); - int childIndex = newParent->IndexOfChild(bookmark_bb_3_); + int childIndex = newParent->GetIndexOf(bookmark_bb_3_); ASSERT_EQ(3, childIndex); } @@ -365,7 +365,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkURLInPlace) { UpdateBB3(); const BookmarkNode* newParent = bookmark_bb_3_->GetParent(); ASSERT_EQ(newParent, oldParent); - int childIndex = newParent->IndexOfChild(bookmark_bb_3_); + int childIndex = newParent->GetIndexOf(bookmark_bb_3_); ASSERT_EQ(3, childIndex); } @@ -375,7 +375,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkGroup) { UpdateBB3(); const BookmarkNode* parent = bookmark_bb_3_->GetParent(); ASSERT_EQ(parent, group_c_); - int childIndex = parent->IndexOfChild(bookmark_bb_3_); + int childIndex = parent->GetIndexOf(bookmark_bb_3_); ASSERT_EQ(4, childIndex); } @@ -386,7 +386,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeNameAndBookmarkGroup) { UpdateBB3(); const BookmarkNode* parent = bookmark_bb_3_->GetParent(); ASSERT_EQ(parent, group_c_); - int childIndex = parent->IndexOfChild(bookmark_bb_3_); + int childIndex = parent->GetIndexOf(bookmark_bb_3_); ASSERT_EQ(4, childIndex); EXPECT_EQ(bookmark_bb_3_->GetTitle(), ASCIIToUTF16("NEW NAME")); } |