diff options
31 files changed, 100 insertions, 100 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_cocoa.mm b/chrome/browser/accessibility/browser_accessibility_cocoa.mm index 3d451cf..30a8f7d 100644 --- a/chrome/browser/accessibility/browser_accessibility_cocoa.mm +++ b/chrome/browser/accessibility/browser_accessibility_cocoa.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. @@ -395,7 +395,7 @@ bool GetState(BrowserAccessibility* accessibility, int state) { } // Returns the index of the child in this objects array of children. -- (NSUInteger)accessibilityIndexOfChild:(id)child { +- (NSUInteger)accessibilityGetIndexOf:(id)child { NSUInteger index = 0; for (BrowserAccessibilityCocoa* childToCheck in [self children]) { if ([child isEqual:childToCheck]) diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index e36d655..5c8d2e7 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1796,7 +1796,7 @@ void TestingAutomationProvider::RemoveBookmark(int handle, if (node) { const BookmarkNode* parent = node->GetParent(); DCHECK(parent); - model->Remove(parent, parent->IndexOfChild(node)); + model->Remove(parent, parent->GetIndexOf(node)); *success = true; } } diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc index 32dba74..fb9e684 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc @@ -159,7 +159,7 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { for (size_t i = 0; i < selection_.size(); ++i) { model_->Remove(selection_[i]->GetParent(), - selection_[i]->GetParent()->IndexOfChild(selection_[i])); + selection_[i]->GetParent()->GetIndexOf(selection_[i])); } selection_.clear(); break; diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index a2cb269..7b71140 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -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. @@ -11,8 +11,8 @@ #include "base/scoped_vector.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_index.h" -#include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/bookmarks/bookmark_storage.h" +#include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/profiles/profile.h" @@ -194,7 +194,7 @@ void BookmarkModel::Move(const BookmarkNode* node, SetDateGroupModified(new_parent, Time::Now()); const BookmarkNode* old_parent = node->GetParent(); - int old_index = old_parent->IndexOfChild(node); + int old_index = old_parent->GetIndexOf(node); if (old_parent == new_parent && (index == old_index || index == old_index + 1)) { @@ -468,7 +468,7 @@ void BookmarkModel::SetURLStarred(const GURL& url, // Remove all the bookmarks. for (size_t i = 0; i < bookmarks.size(); ++i) { const BookmarkNode* node = bookmarks[i]; - Remove(node->GetParent(), node->GetParent()->IndexOfChild(node)); + Remove(node->GetParent(), node->GetParent()->GetIndexOf(node)); } } } @@ -598,7 +598,7 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { BookmarkNode* parent = AsMutable(node->GetParent()); DCHECK(parent); - int index = parent->IndexOfChild(node.get()); + int index = parent->GetIndexOf(node.get()); parent->Remove(index); history::URLsStarredDetails details(false); { diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 9b07195..185073b 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -262,7 +262,7 @@ int PerformBookmarkDrop(Profile* profile, // Drag from same profile. Move nodes. for (size_t i = 0; i < dragged_nodes.size(); ++i) { model->Move(dragged_nodes[i], parent_node, index); - index = parent_node->IndexOfChild(dragged_nodes[i]) + 1; + index = parent_node->GetIndexOf(dragged_nodes[i]) + 1; } return ui::DragDropTypes::DRAG_MOVE; } @@ -292,7 +292,7 @@ bool IsValidDropLocation(Profile* profile, // nodes being dragged. const BookmarkNode* node = nodes[i]; int node_index = (drop_parent == node->GetParent()) ? - drop_parent->IndexOfChild(nodes[i]) : -1; + drop_parent->GetIndexOf(nodes[i]) : -1; if (node_index != -1 && (index == node_index || index == node_index + 1)) return false; @@ -404,7 +404,7 @@ void CopyToClipboard(BookmarkModel* model, if (remove_nodes) { for (size_t i = 0; i < nodes.size(); ++i) { model->Remove(nodes[i]->GetParent(), - nodes[i]->GetParent()->IndexOfChild(nodes[i])); + nodes[i]->GetParent()->GetIndexOf(nodes[i])); } } } @@ -649,7 +649,7 @@ const BookmarkNode* GetParentForNewNodes( if (index) { if (selection.size() == 1 && selection[0]->is_url()) { - *index = real_parent->IndexOfChild(selection[0]) + 1; + *index = real_parent->GetIndexOf(selection[0]) + 1; if (*index == 0) { // Node doesn't exist in parent, add to end. NOTREACHED(); diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc index c88be0c..357143e 100644 --- a/chrome/browser/cookies_tree_model.cc +++ b/chrome/browser/cookies_tree_model.cc @@ -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. @@ -644,7 +644,7 @@ void CookiesTreeModel::DeleteCookieNode(CookieTreeNode* cookie_node) { cookie_node->DeleteStoredObjects(); // find the parent and index CookieTreeNode* parent_node = cookie_node->GetParent(); - int cookie_node_index = parent_node->IndexOfChild(cookie_node); + int cookie_node_index = parent_node->GetIndexOf(cookie_node); delete Remove(parent_node, cookie_node_index); if (parent_node->GetChildCount() == 0) DeleteCookieNode(parent_node); diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index ccf43f2..03fe0b6 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -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. @@ -209,7 +209,7 @@ class CookiesTreeModelTest : public testing::Test { // find the parent and index CookieTreeNode* parent_node = node->GetParent(); DCHECK(parent_node); - int ct_node_index = parent_node->IndexOfChild(node); + int ct_node_index = parent_node->GetIndexOf(node); delete parent_node->GetModel()->Remove(parent_node, ct_node_index); } protected: diff --git a/chrome/browser/extensions/extension_bookmark_helpers.cc b/chrome/browser/extensions/extension_bookmark_helpers.cc index a48a12c..6829cc4 100644 --- a/chrome/browser/extensions/extension_bookmark_helpers.cc +++ b/chrome/browser/extensions/extension_bookmark_helpers.cc @@ -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. @@ -23,7 +23,7 @@ DictionaryValue* GetNodeDictionary(const BookmarkNode* node, const BookmarkNode* parent = node->GetParent(); if (parent) { dict->SetString(keys::kParentIdKey, base::Int64ToString(parent->id())); - dict->SetInteger(keys::kIndexKey, parent->IndexOfChild(node)); + dict->SetInteger(keys::kIndexKey, parent->GetIndexOf(node)); } if (!node->is_folder()) { @@ -101,7 +101,7 @@ bool RemoveNode(BookmarkModel* model, } const BookmarkNode* parent = node->GetParent(); - int index = parent->IndexOfChild(node); + int index = parent->GetIndexOf(node); model->Remove(parent, index); return true; } diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc index 31c0c51..bdb960d 100644 --- a/chrome/browser/extensions/extension_bookmark_manager_api.cc +++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc @@ -245,7 +245,7 @@ bool PasteBookmarkManagerFunction::RunImpl() { int highest_index = -1; // -1 means insert at end of list. for (size_t node = 0; node < nodes.size(); ++node) { // + 1 so that we insert after the selection. - int this_node_index = parent_node->IndexOfChild(nodes[node]) + 1; + int this_node_index = parent_node->GetIndexOf(nodes[node]) + 1; if (this_node_index > highest_index) highest_index = this_node_index; } diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index d1a2414..c3e1279 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.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. @@ -25,9 +25,9 @@ #import "chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/edit_command.h" #include "chrome/common/gpu_messages.h" +#include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "content/browser/browser_thread.h" @@ -38,12 +38,12 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "skia/ext/platform_canvas.h" +#import "third_party/mozilla/ComplexTextInputPanel.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFactory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/webaccessibility.h" #include "webkit/plugins/npapi/webplugin.h" -#import "third_party/mozilla/ComplexTextInputPanel.h" using WebKit::WebInputEvent; using WebKit::WebInputEventFactory; @@ -2073,7 +2073,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { return NO; } -- (NSUInteger)accessibilityIndexOfChild:(id)child { +- (NSUInteger)accessibilityGetIndexOf:(id)child { BrowserAccessibilityManager* manager = renderWidgetHostView_->browser_accessibility_manager_.get(); // Only child is root. diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index ad673ef..316fb3d 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -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. #include "chrome/browser/sync/glue/bookmark_change_processor.h" @@ -107,7 +107,7 @@ void BookmarkChangeProcessor::RemoveSyncNodeHierarchy( int index = 0; while (node) { // The top of |index_stack| should always be |node|'s index. - DCHECK(!node->GetParent() || (node->GetParent()->IndexOfChild(node) == + DCHECK(!node->GetParent() || (node->GetParent()->GetIndexOf(node) == index_stack.top())); if (index == node->GetChildCount()) { // If we've processed all of |node|'s children, delete |node| and move @@ -214,7 +214,7 @@ void BookmarkChangeProcessor::BookmarkNodeChanged(BookmarkModel* model, sync_node.GetParentId()), node->GetParent()); // This node's index should be one more than the predecessor's index. - DCHECK_EQ(node->GetParent()->IndexOfChild(node), + DCHECK_EQ(node->GetParent()->GetIndexOf(node), CalculateBookmarkModelInsertionIndex(node->GetParent(), &sync_node)); } @@ -343,7 +343,7 @@ int BookmarkChangeProcessor::CalculateBookmarkModelInsertionIndex( model_associator_->GetChromeNodeFromSyncId(predecessor_id); DCHECK(predecessor); DCHECK_EQ(predecessor->GetParent(), parent); - return parent->IndexOfChild(predecessor) + 1; + return parent->GetIndexOf(predecessor) + 1; } // ApplyModelChanges is called by the sync backend after changes have been made @@ -410,7 +410,7 @@ void BookmarkChangeProcessor::ApplyChangesFromSyncModel( } DCHECK_EQ(dst->GetChildCount(), 0) << "Node being deleted has children"; model_associator_->Disassociate(changes[i].id); - model->Remove(parent, parent->IndexOfChild(dst)); + model->Remove(parent, parent->GetIndexOf(dst)); dst = NULL; } else { DCHECK_EQ((changes[i].action == @@ -432,7 +432,7 @@ void BookmarkChangeProcessor::ApplyChangesFromSyncModel( // There should be no nodes left under the foster parent. DCHECK_EQ(foster_parent->GetChildCount(), 0); model->Remove(foster_parent->GetParent(), - foster_parent->GetParent()->IndexOfChild(foster_parent)); + foster_parent->GetParent()->GetIndexOf(foster_parent)); foster_parent = NULL; } diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 5226715..07c0ceb 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -1,17 +1,16 @@ -// 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. #include <stack> #include <vector> -#include "testing/gtest/include/gtest/gtest.h" #include "base/file_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/string16.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -20,10 +19,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/engine/syncapi.h" -#include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/bookmark_change_processor.h" #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" #include "chrome/browser/sync/glue/bookmark_model_associator.h" +#include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/model_associator.h" #include "chrome/browser/sync/glue/sync_backend_host.h" @@ -32,14 +31,15 @@ #include "chrome/browser/sync/js_test_util.h" #include "chrome/browser/sync/profile_sync_factory.h" #include "chrome/browser/sync/profile_sync_factory_mock.h" -#include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" +#include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" -#include "chrome/test/testing_profile.h" #include "chrome/test/testing_pref_service.h" +#include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" using std::vector; using browser_sync::AssociatorInterface; @@ -392,7 +392,7 @@ class ProfileSyncServiceTest : public testing::Test { EXPECT_EQ(bnode->GetURL(), gnode.GetURL()); // Check for position matches. - int browser_index = bnode->GetParent()->IndexOfChild(bnode); + int browser_index = bnode->GetParent()->GetIndexOf(bnode); if (browser_index == 0) { EXPECT_EQ(gnode.GetPredecessorId(), 0); } else { @@ -479,8 +479,8 @@ class ProfileSyncServiceTest : public testing::Test { void ExpectModelMatch(sync_api::BaseTransaction* trans) { const BookmarkNode* root = model_->root_node(); - EXPECT_EQ(root->IndexOfChild(model_->GetBookmarkBarNode()), 0); - EXPECT_EQ(root->IndexOfChild(model_->other_node()), 1); + EXPECT_EQ(root->GetIndexOf(model_->GetBookmarkBarNode()), 0); + EXPECT_EQ(root->GetIndexOf(model_->other_node()), 1); std::stack<int64> stack; stack.push(bookmark_bar_id()); @@ -613,11 +613,11 @@ TEST_F(ProfileSyncServiceTest, BookmarkModelOperations) { // Test deletion. // Delete a single item. - model_->Remove(url2->GetParent(), url2->GetParent()->IndexOfChild(url2)); + model_->Remove(url2->GetParent(), url2->GetParent()->GetIndexOf(url2)); ExpectModelMatch(); // Delete an item with several children. model_->Remove(folder2->GetParent(), - folder2->GetParent()->IndexOfChild(folder2)); + folder2->GetParent()->GetIndexOf(folder2)); ExpectModelMatch(); } diff --git a/chrome/browser/ui/cocoa/applescript/bookmark_node_applescript.mm b/chrome/browser/ui/cocoa/applescript/bookmark_node_applescript.mm index 3dabbbe..ff43be5 100644 --- a/chrome/browser/ui/cocoa/applescript/bookmark_node_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/bookmark_node_applescript.mm @@ -1,12 +1,12 @@ -// 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. #import "chrome/browser/ui/cocoa/applescript/bookmark_node_applescript.h" #include "base/logging.h" -#include "base/sys_string_conversions.h" #import "base/scoped_nsobject.h" +#include "base/sys_string_conversions.h" #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/bookmarks/bookmark_model.h" #import "chrome/browser/chrome_browser_application_mac.h" @@ -104,7 +104,7 @@ - (NSNumber*)index { const BookmarkNode* parent = bookmarkNode_->GetParent(); - int index = parent->IndexOfChild(bookmarkNode_); + int index = parent->GetIndexOf(bookmarkNode_); // NOTE: AppleScript is 1-Based. return [NSNumber numberWithInt:index+1]; } 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")); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index 71e34d2..1e788f7 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -481,7 +481,7 @@ void BookmarkBarGtk::BookmarkNodeChanged(BookmarkModel* model, // We only care about nodes on the bookmark bar. return; } - int index = model_->GetBookmarkBarNode()->IndexOfChild(node); + int index = model_->GetBookmarkBarNode()->GetIndexOf(node); DCHECK(index != -1); GtkToolItem* item = gtk_toolbar_get_nth_item( @@ -736,7 +736,7 @@ void BookmarkBarGtk::StartThrobbing(const BookmarkNode* node) { widget_to_throb = other_bookmarks_button_; } else { int hidden = GetFirstHiddenBookmark(0, NULL); - int idx = model_->GetBookmarkBarNode()->IndexOfChild(parent_on_bb); + int idx = model_->GetBookmarkBarNode()->GetIndexOf(parent_on_bb); if (hidden >= 0 && hidden <= idx) { widget_to_throb = overflow_button_; @@ -1272,7 +1272,7 @@ void BookmarkBarGtk::OnDragReceived(GtkWidget* widget, for (std::vector<const BookmarkNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it) { model_->Move(*it, dest_node, index); - index = dest_node->IndexOfChild(*it) + 1; + index = dest_node->GetIndexOf(*it) + 1; } break; } @@ -1392,7 +1392,7 @@ void BookmarkBarGtk::PopupForButton(GtkWidget* button) { } else { // Overflow exists: don't show anything for an overflowed folder button. if (button != overflow_button_ && button != other_bookmarks_button_ && - node->GetParent()->IndexOfChild(node) >= first_hidden) { + node->GetParent()->GetIndexOf(node) >= first_hidden) { return; } } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc index c652fbe..5538ca7 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc @@ -205,7 +205,7 @@ BookmarkBubbleGtk::~BookmarkBubbleGtk() { BookmarkModel* model = profile_->GetBookmarkModel(); const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); if (node) - model->Remove(node->GetParent(), node->GetParent()->IndexOfChild(node)); + model->Remove(node->GetParent(), node->GetParent()->GetIndexOf(node)); } } diff --git a/chrome/browser/ui/gtk/gtk_tree.cc b/chrome/browser/ui/gtk/gtk_tree.cc index 7c16ac9..9ff0416 100644 --- a/chrome/browser/ui/gtk/gtk_tree.cc +++ b/chrome/browser/ui/gtk/gtk_tree.cc @@ -410,7 +410,7 @@ GtkTreePath* TreeAdapter::GetTreePath(ui::TreeModelNode* node) { while (parent) { parent = tree_model_->GetParent(parent); if (parent) { - int idx = tree_model_->IndexOfChild(parent, node); + int idx = tree_model_->GetIndexOf(parent, node); gtk_tree_path_prepend_index(path, idx); node = parent; } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index aee3bf8..0a630b6 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -824,7 +824,7 @@ views::MenuButton* BookmarkBarView::GetMenuButtonForNode( return other_bookmarked_button_; if (node == model_->GetBookmarkBarNode()) return overflow_button_; - int index = model_->GetBookmarkBarNode()->IndexOfChild(node); + int index = model_->GetBookmarkBarNode()->GetIndexOf(node); if (index == -1 || !node->is_folder()) return NULL; return static_cast<views::MenuButton*>(GetChildViewAt(index)); @@ -1041,7 +1041,7 @@ void BookmarkBarView::BookmarkNodeChangedImpl(BookmarkModel* model, // We only care about nodes on the bookmark bar. return; } - int index = model_->GetBookmarkBarNode()->IndexOfChild(node); + int index = model_->GetBookmarkBarNode()->GetIndexOf(node); DCHECK_NE(-1, index); views::TextButton* button = GetBookmarkButton(index); gfx::Size old_pref = button->GetPreferredSize(); @@ -1513,7 +1513,7 @@ void BookmarkBarView::StartThrobbing(const BookmarkNode* node, parent_on_bb = parent; } if (parent_on_bb) { - int index = bbn->IndexOfChild(parent_on_bb); + int index = bbn->GetIndexOf(parent_on_bb); if (index >= GetFirstHiddenNodeIndex()) { // Node is hidden, animate the overflow button. throbbing_view_ = overflow_button_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 75aea90..4066c73 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -128,7 +128,7 @@ BookmarkBubbleView::~BookmarkBubbleView() { BookmarkModel* model = profile_->GetBookmarkModel(); const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); if (node) - model->Remove(node->GetParent(), node->GetParent()->IndexOfChild(node)); + model->Remove(node->GetParent(), node->GetParent()->GetIndexOf(node)); } } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc index 84bc69d..40e5c4b 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc @@ -147,7 +147,7 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { delegate_->WillRemoveBookmarks(selection_); for (size_t i = 0; i < selection_.size(); ++i) { model->Remove(selection_[i]->GetParent(), - selection_[i]->GetParent()->IndexOfChild(selection_[i])); + selection_[i]->GetParent()->GetIndexOf(selection_[i])); } delegate_->DidRemoveBookmarks(); selection_.clear(); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc index 03a1aec..b4f8dbf 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc @@ -163,7 +163,7 @@ int BookmarkMenuController::GetDropOperation( const BookmarkNode* node = menu_id_to_node_map_[item->GetCommand()]; const BookmarkNode* drop_parent = node->GetParent(); - int index_to_drop_at = drop_parent->IndexOfChild(node); + int index_to_drop_at = drop_parent->GetIndexOf(node); if (*position == DROP_AFTER) { index_to_drop_at++; } else if (*position == DROP_ON) { @@ -184,7 +184,7 @@ int BookmarkMenuController::OnPerformDrop(MenuItemView* menu, DCHECK(model); const BookmarkNode* drop_parent = drop_node->GetParent(); DCHECK(drop_parent); - int index_to_drop_at = drop_parent->IndexOfChild(drop_node); + int index_to_drop_at = drop_parent->GetIndexOf(drop_node); if (position == DROP_AFTER) { index_to_drop_at++; } else if (position == DROP_ON) { diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc index 638916f..8a2d638 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.cc +++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc @@ -208,7 +208,7 @@ CookieTreeNode* GetTreeNodeFromPath(CookieTreeNode* root, child = reinterpret_cast<CookieTreeNode*>( HexStringToPointer(node_ids[i])); - child_index = parent->IndexOfChild(child); + child_index = parent->GetIndexOf(child); if (child_index == -1) break; diff --git a/chrome/test/live_sync/bookmark_model_verifier.cc b/chrome/test/live_sync/bookmark_model_verifier.cc index ec0e87d..e65319f 100644 --- a/chrome/test/live_sync/bookmark_model_verifier.cc +++ b/chrome/test/live_sync/bookmark_model_verifier.cc @@ -1,11 +1,11 @@ -// 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. #include "chrome/test/live_sync/bookmark_model_verifier.h" -#include <vector> #include <stack> +#include <vector> #include "base/rand_util.h" #include "base/string_number_conversions.h" @@ -85,11 +85,11 @@ bool BookmarkModelVerifier::NodesMatch(const BookmarkNode* node_a, << node_b->GetURL(); return false; } - if (node_a->GetParent()->IndexOfChild(node_a) != - node_b->GetParent()->IndexOfChild(node_b)) { + if (node_a->GetParent()->GetIndexOf(node_a) != + node_b->GetParent()->GetIndexOf(node_b)) { LOG(ERROR) << "Index mismatch: " - << node_a->GetParent()->IndexOfChild(node_a) << " vs. " - << node_b->GetParent()->IndexOfChild(node_b); + << node_a->GetParent()->GetIndexOf(node_a) << " vs. " + << node_b->GetParent()->GetIndexOf(node_b); return false; } return true; @@ -186,7 +186,7 @@ void BookmarkModelVerifier::FindNodeInVerifier(BookmarkModel* foreign_model, std::stack<int> path; const BookmarkNode* walker = foreign_node; while (walker != foreign_model->root_node()) { - path.push(walker->GetParent()->IndexOfChild(walker)); + path.push(walker->GetParent()->GetIndexOf(walker)); walker = walker->GetParent(); } diff --git a/chrome/test/live_sync/single_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/single_client_live_bookmarks_sync_test.cc index 75cb8e4..759ff43 100644 --- a/chrome/test/live_sync/single_client_live_bookmarks_sync_test.cc +++ b/chrome/test/live_sync/single_client_live_bookmarks_sync_test.cc @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientLiveBookmarksSyncTest, Sanity) { "Rearrange stuff in tier1_a")); ASSERT_TRUE(ModelMatchesVerifier(0)); - ASSERT_EQ(1, tier1_a_url0->GetParent()->IndexOfChild(tier1_a_url0)); + ASSERT_EQ(1, tier1_a_url0->GetParent()->GetIndexOf(tier1_a_url0)); Move(0, tier1_a_url0, bar, bar->GetChildCount()); const BookmarkNode* boa = AddURL(0, bar, bar->GetChildCount(), L"Bank of America", GURL("https://www.bankofamerica.com")); diff --git a/ui/base/models/tree_model.h b/ui/base/models/tree_model.h index c133c0b..190115b 100644 --- a/ui/base/models/tree_model.h +++ b/ui/base/models/tree_model.h @@ -59,16 +59,16 @@ class TreeModel { // see SetRootShown for details. virtual TreeModelNode* GetRoot() = 0; - // Returns the number of children in the specified node. + // Returns the number of children in |parent|. virtual int GetChildCount(TreeModelNode* parent) = 0; - // Returns the child node at the specified index. + // Returns the child node of |parent| at |index|. virtual TreeModelNode* GetChild(TreeModelNode* parent, int index) = 0; - // Returns the index of child node at the specified index. - virtual int IndexOfChild(TreeModelNode* parent, TreeModelNode* child) = 0; + // Returns the index of |child| in |parent|. + virtual int GetIndexOf(TreeModelNode* parent, TreeModelNode* child) = 0; - // Returns the parent of a node, or NULL if node is the root. + // Returns the parent of |node|, or NULL if |node| is the root. virtual TreeModelNode* GetParent(TreeModelNode* node) = 0; // Adds an observer of the model. @@ -77,7 +77,7 @@ class TreeModel { // Removes an observer of the model. virtual void RemoveObserver(TreeModelObserver* observer) = 0; - // Sets the title of the specified node. + // Sets the title of |node|. // This is only invoked if the node is editable and the user edits a node. virtual void SetTitle(TreeModelNode* node, const string16& title); diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h index 0c64625..34f6ee8 100644 --- a/ui/base/models/tree_node_model.h +++ b/ui/base/models/tree_node_model.h @@ -86,7 +86,7 @@ class TreeNode : public TreeModelNode { // If the node has a parent, remove it from its parent. NodeType* node_parent = child->GetParent(); if (node_parent) - node_parent->Remove(node_parent->IndexOfChild(child)); + node_parent->Remove(node_parent->GetIndexOf(child)); child->parent_ = static_cast<NodeType*>(this); children_->insert(children_->begin() + index, child); } @@ -143,8 +143,8 @@ class TreeNode : public TreeModelNode { return parent_; } - // Returns the index of the specified child, or -1 if node is a not a child. - int IndexOfChild(const NodeType* node) const { + // Returns the index of |node|, or -1 if |node| is not a child of this. + int GetIndexOf(const NodeType* node) const { DCHECK(node); typename std::vector<NodeType*>::const_iterator i = std::find(children_->begin(), children_->end(), node); @@ -249,9 +249,9 @@ class TreeNodeModel : public TreeModel { return AsNode(parent)->GetChild(index); } - virtual int IndexOfChild(TreeModelNode* parent, TreeModelNode* child) { + virtual int GetIndexOf(TreeModelNode* parent, TreeModelNode* child) { DCHECK(parent); - return AsNode(parent)->IndexOfChild(AsNode(child)); + return AsNode(parent)->GetIndexOf(AsNode(child)); } virtual TreeModelNode* GetParent(TreeModelNode* node) { diff --git a/ui/base/models/tree_node_model_unittest.cc b/ui/base/models/tree_node_model_unittest.cc index c4747d4..afeed6d 100644 --- a/ui/base/models/tree_node_model_unittest.cc +++ b/ui/base/models/tree_node_model_unittest.cc @@ -171,7 +171,7 @@ TEST_F(TreeNodeModelTest, RemoveAllNodes) { // |-- child1 // | |-- foo1 // +-- child2 -TEST_F(TreeNodeModelTest, IndexOfChild) { +TEST_F(TreeNodeModelTest, GetIndexOf) { TreeNodeWithValue<int>* root = new TreeNodeWithValue<int>(ASCIIToUTF16("root"), 0); TreeNodeModel<TreeNodeWithValue<int> > model(root); @@ -190,10 +190,10 @@ TEST_F(TreeNodeModelTest, IndexOfChild) { new TreeNodeWithValue<int>(ASCIIToUTF16("foo1"), 0); model.Add(child1, 0, foo1); - ASSERT_EQ(0, model.IndexOfChild(root, child1)); - ASSERT_EQ(1, model.IndexOfChild(root, child2)); - ASSERT_EQ(0, model.IndexOfChild(child1, foo1)); - ASSERT_EQ(-1, model.IndexOfChild(root, foo1)); + ASSERT_EQ(0, model.GetIndexOf(root, child1)); + ASSERT_EQ(1, model.GetIndexOf(root, child2)); + ASSERT_EQ(0, model.GetIndexOf(child1, foo1)); + ASSERT_EQ(-1, model.GetIndexOf(root, foo1)); } // Verify whether a specified node has or not an ancestor. |