diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 21:53:44 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 21:53:44 +0000 |
commit | 9fcaee7b1abf5941e917eaf14bccad6eb13a74fa (patch) | |
tree | 17e4a5b8e32da2de69cb8fa387839bba1500a1dd /chrome | |
parent | 1fd6dccfc0bd2383005181c52635ff5b90dbae78 (diff) | |
download | chromium_src-9fcaee7b1abf5941e917eaf14bccad6eb13a74fa.zip chromium_src-9fcaee7b1abf5941e917eaf14bccad6eb13a74fa.tar.gz chromium_src-9fcaee7b1abf5941e917eaf14bccad6eb13a74fa.tar.bz2 |
bookmarks: Rename more entries from Group/group/GROUP to Folder/folder/FOLDER.
BUG=None
TEST=None
R=sky@chromium.org
Review URL: http://codereview.chromium.org/6685113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
20 files changed, 211 insertions, 211 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index 43109e8..5439fc0 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -69,7 +69,7 @@ void BookmarkNode::Reset(const history::StarredEntry& entry) { case history::StarredEntry::URL: type_ = BookmarkNode::URL; break; - case history::StarredEntry::USER_GROUP: + case history::StarredEntry::USER_FOLDER: type_ = BookmarkNode::FOLDER; break; case history::StarredEntry::BOOKMARK_BAR: @@ -164,7 +164,7 @@ void BookmarkModel::Load() { const BookmarkNode* BookmarkModel::GetParentForNewNodes() { std::vector<const BookmarkNode*> nodes = - bookmark_utils::GetMostRecentlyModifiedGroups(this, 1); + bookmark_utils::GetMostRecentlyModifiedFolders(this, 1); return nodes.empty() ? bookmark_bar_node_ : nodes[0]; } diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 1adb366..ddb1cb7 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -238,7 +238,7 @@ TEST_F(BookmarkModelTest, RemoveURL) { ASSERT_TRUE(model.GetMostRecentlyAddedNodeForURL(url) == NULL); } -TEST_F(BookmarkModelTest, RemoveGroup) { +TEST_F(BookmarkModelTest, RemoveFolder) { const BookmarkNode* root = model.GetBookmarkBarNode(); const BookmarkNode* folder = model.AddFolder(root, 0, ASCIIToUTF16("foo")); @@ -384,7 +384,7 @@ TEST_F(BookmarkModelTest, ParentForNewNodes) { } // Make sure recently modified stays in sync when adding a URL. -TEST_F(BookmarkModelTest, MostRecentlyModifiedGroups) { +TEST_F(BookmarkModelTest, MostRecentlyModifiedFolders) { // Add a folder. const BookmarkNode* folder = model.AddFolder(model.other_node(), 0, ASCIIToUTF16("foo")); @@ -393,7 +393,7 @@ TEST_F(BookmarkModelTest, MostRecentlyModifiedGroups) { // Make sure folder is in the most recently modified. std::vector<const BookmarkNode*> most_recent_folders = - bookmark_utils::GetMostRecentlyModifiedGroups(&model, 1); + bookmark_utils::GetMostRecentlyModifiedFolders(&model, 1); ASSERT_EQ(1U, most_recent_folders.size()); ASSERT_EQ(folder, most_recent_folders[0]); @@ -401,7 +401,7 @@ TEST_F(BookmarkModelTest, MostRecentlyModifiedGroups) { // returned list. model.Remove(folder->parent(), 0); most_recent_folders = - bookmark_utils::GetMostRecentlyModifiedGroups(&model, 1); + bookmark_utils::GetMostRecentlyModifiedFolders(&model, 1); ASSERT_EQ(1U, most_recent_folders.size()); ASSERT_TRUE(most_recent_folders[0] != folder); } @@ -580,7 +580,7 @@ static void PopulateNodeImpl(const std::vector<std::string>& description, (*index)++; if (element == "[") { // Create a new folder and recurse to add all the children. - // Groups are given a unique named by way of an ever increasing integer + // Folders are given a unique named by way of an ever increasing integer // value. The folders need not have a name, but one is assigned to help // in debugging. static int next_folder_id = 1; @@ -607,7 +607,7 @@ static void PopulateNodeImpl(const std::vector<std::string>& description, // Creates and adds nodes to parent based on description. description consists // of the following tokens (all space separated): -// [ : creates a new USER_GROUP node. All elements following the [ until the +// [ : creates a new USER_FOLDER node. All elements following the [ until the // next balanced ] is encountered are added as children to the node. // ] : closes the last folder created by [ so that any further nodes are added // to the current folders parent. diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 7bcb716..2709a27 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -146,7 +146,7 @@ void OpenAllImpl(const BookmarkNode* node, } // else, new_browser == NULL, which happens during testing. } } else { - // Group, recurse through children. + // Folder, recurse through children. for (int i = 0; i < node->child_count(); ++i) { OpenAllImpl(node->GetChild(i), initial_disposition, navigator, opened_url); @@ -440,7 +440,7 @@ string16 GetNameForURL(const GURL& url) { } } -std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( +std::vector<const BookmarkNode*> GetMostRecentlyModifiedFolders( BookmarkModel* model, size_t max_count) { std::vector<const BookmarkNode*> nodes; @@ -563,7 +563,7 @@ static const BookmarkNode* CreateNewNode(BookmarkModel* model, return node; } -const BookmarkNode* ApplyEditsWithNoGroupChange(BookmarkModel* model, +const BookmarkNode* ApplyEditsWithNoFolderChange(BookmarkModel* model, const BookmarkNode* parent, const BookmarkEditor::EditDetails& details, const string16& new_title, const GURL& new_url) { if (details.type == BookmarkEditor::EditDetails::NEW_URL || @@ -581,7 +581,7 @@ const BookmarkNode* ApplyEditsWithNoGroupChange(BookmarkModel* model, return node; } -const BookmarkNode* ApplyEditsWithPossibleGroupChange(BookmarkModel* model, +const BookmarkNode* ApplyEditsWithPossibleFolderChange(BookmarkModel* model, const BookmarkNode* new_parent, const BookmarkEditor::EditDetails& details, const string16& new_title, const GURL& new_url) { if (details.type == BookmarkEditor::EditDetails::NEW_URL || diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index b2ed767..6e14bc9 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -10,8 +10,8 @@ #include <vector> #include "base/string16.h" -#include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/bookmarks/bookmark_editor.h" +#include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/history/snippet.h" #include "ui/gfx/native_widget_types.h" #include "webkit/glue/window_open_disposition.h" @@ -119,7 +119,7 @@ string16 GetNameForURL(const GURL& url); // Returns a vector containing up to |max_count| of the most recently modified // folders. This never returns an empty vector. -std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( +std::vector<const BookmarkNode*> GetMostRecentlyModifiedFolders( BookmarkModel* model, size_t max_count); // Returns the most recently added bookmarks. This does not return folders, @@ -162,7 +162,7 @@ bool DoesBookmarkContainText(const BookmarkNode* node, // done regarding moving from one folder to another). If a new node is // explicitly being added, returns a pointer to the new node that was created. // Otherwise the return value is identically |node|. -const BookmarkNode* ApplyEditsWithNoGroupChange( +const BookmarkNode* ApplyEditsWithNoFolderChange( BookmarkModel* model, const BookmarkNode* parent, const BookmarkEditor::EditDetails& details, @@ -173,7 +173,7 @@ const BookmarkNode* ApplyEditsWithNoGroupChange( // changed and the node will need to be removed and reinserted. If a new node // is explicitly being added, returns a pointer to the new node that was // created. Otherwise the return value is identically |node|. -const BookmarkNode* ApplyEditsWithPossibleGroupChange( +const BookmarkNode* ApplyEditsWithPossibleFolderChange( BookmarkModel* model, const BookmarkNode* new_parent, const BookmarkEditor::EditDetails& details, diff --git a/chrome/browser/bookmarks/recently_used_folders_combo_model.cc b/chrome/browser/bookmarks/recently_used_folders_combo_model.cc index ca227ba..3bc18e2 100644 --- a/chrome/browser/bookmarks/recently_used_folders_combo_model.cc +++ b/chrome/browser/bookmarks/recently_used_folders_combo_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. @@ -18,7 +18,7 @@ const size_t kMaxMRUFolders = 5; RecentlyUsedFoldersComboModel::RecentlyUsedFoldersComboModel( BookmarkModel* model, const BookmarkNode* node) // Use + 2 to account for bookmark bar and other node. - : nodes_(bookmark_utils::GetMostRecentlyModifiedGroups( + : nodes_(bookmark_utils::GetMostRecentlyModifiedFolders( model, kMaxMRUFolders + 2)), node_parent_index_(0) { // TODO(sky): bug 1173415 add a separator in the combobox here. diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 7090ad5..ae4964d 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -99,7 +99,7 @@ class HistoryService : public CancelableRequestProvider, // Miscellaneous commonly-used types. typedef std::vector<PageUsageData*> PageUsageDataList; - // ID (both star_id and group_id) of the bookmark bar. + // ID (both star_id and folder_id) of the bookmark bar. // This entry always exists. static const history::StarID kBookmarkBarID; diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index 861f6d2..a07d352 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -101,8 +101,8 @@ ImportedFaviconUsage::~ImportedFaviconUsage() { StarredEntry::StarredEntry() : id(0), - parent_group_id(0), - group_id(0), + parent_folder_id(0), + folder_id(0), visual_order(0), type(URL), url_id(0) { @@ -115,8 +115,8 @@ void StarredEntry::Swap(StarredEntry* other) { std::swap(id, other->id); title.swap(other->title); std::swap(date_added, other->date_added); - std::swap(parent_group_id, other->parent_group_id); - std::swap(group_id, other->group_id); + std::swap(parent_folder_id, other->parent_folder_id); + std::swap(folder_id, other->folder_id); std::swap(visual_order, other->visual_order); std::swap(type, other->type); url.Swap(&other->url); diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index 5aef72f..d144651 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -260,27 +260,27 @@ struct PageVisit { // StarredEntry --------------------------------------------------------------- -// StarredEntry represents either a starred page, or a star grouping (where -// a star grouping consists of child starred entries). Use the type to -// determine the type of a particular entry. +// StarredEntry represents either a starred page, or a folder (where a folder +// consists of child starred entries). Use the type to determine the type of a +// particular entry. // // The database internally uses the id field to uniquely identify a starred // entry. On the other hand, the UI, which is anything routed through // HistoryService and HistoryBackend (including BookmarkBarView), uses the -// url field to uniquely identify starred entries of type URL and the group_id -// field to uniquely identify starred entries of type USER_GROUP. For example, +// url field to uniquely identify starred entries of type URL and the folder_id +// field to uniquely identify starred entries of type USER_FOLDER. For example, // HistoryService::UpdateStarredEntry identifies the entry by url (if the -// type is URL) or group_id (if the type is not URL). +// type is URL) or folder_id (if the type is not URL). struct StarredEntry { enum Type { - // Type represents a starred URL (StarredEntry). + // Type represents a starred URL. URL, - // The bookmark bar grouping. + // The bookmark bar folder. BOOKMARK_BAR, - // User created group. - USER_GROUP, + // User created folder. + USER_FOLDER, // The "other bookmarks" folder that holds uncategorized bookmarks. OTHER @@ -300,17 +300,17 @@ struct StarredEntry { // When this was added. base::Time date_added; - // Group ID of the star group this entry is in. If 0, this entry is not - // in a star group. - UIStarID parent_group_id; + // Folder ID of the folder this entry is in. If 0, this entry is not in a + // folder. + UIStarID parent_folder_id; - // Unique identifier for groups. This is assigned by the UI. + // Unique identifier for folders. This is assigned by the UI. // // WARNING: this is NOT the same as id, id is assigned by the database, // this is assigned by the UI. See note about StarredEntry for more info. - UIStarID group_id; + UIStarID folder_id; - // Visual order within the parent. Only valid if group_id is not 0. + // Visual order within the parent. Only valid if folder_id is not 0. int visual_order; // Type of this entry (see enum). @@ -323,8 +323,8 @@ struct StarredEntry { // starred. URLID url_id; - // Time the entry was last modified. This is only used for groups and - // indicates the last time a URL was added as a child to the group. + // Time the entry was last modified. This is only used for folders and + // indicates the last time a URL was added as a child to the folder. base::Time date_folder_modified; }; diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc index 6543178..83bc0c3 100644 --- a/chrome/browser/history/starred_url_database.cc +++ b/chrome/browser/history/starred_url_database.cc @@ -6,8 +6,8 @@ #include "app/sql/statement.h" #include "base/file_util.h" -#include "base/logging.h" #include "base/json/json_writer.h" +#include "base/logging.h" #include "base/scoped_vector.h" #include "base/stl_util-inl.h" #include "base/string_util.h" @@ -24,17 +24,17 @@ // starred // id Unique identifier (primary key) for the entry. // type Type of entry, if 0 this corresponds to a URL, 1 for -// a system grouping, 2 for a user created group, 3 for +// a system folder, 2 for a user created folder, 3 for // other. // url_id ID of the url, only valid if type == 0 -// group_id ID of the group, only valid if type != 0. This id comes +// group_id ID of the folder, only valid if type != 0. This id comes // from the UI and is NOT the same as id. // title User assigned title. // date_added Creation date. // visual_order Visual order within parent. -// parent_id Group ID of the parent this entry is contained in, if 0 -// entry is not in a group. -// date_modified Time the group was last modified. See comments in +// parent_id Folder ID of the parent this entry is contained in, if 0 +// entry is not in a folder. +// date_modified Time the folder was last modified. See comments in // StarredEntry::date_folder_modified // NOTE: group_id and parent_id come from the UI, id is assigned by the // db. @@ -62,7 +62,7 @@ void FillInStarredEntry(const sql::Statement& s, StarredEntry* entry) { entry->type = history::StarredEntry::BOOKMARK_BAR; break; case 2: - entry->type = history::StarredEntry::USER_GROUP; + entry->type = history::StarredEntry::USER_FOLDER; break; case 3: entry->type = history::StarredEntry::OTHER; @@ -74,9 +74,9 @@ void FillInStarredEntry(const sql::Statement& s, StarredEntry* entry) { entry->title = s.ColumnString16(2); entry->date_added = base::Time::FromInternalValue(s.ColumnInt64(3)); entry->visual_order = s.ColumnInt(4); - entry->parent_group_id = s.ColumnInt64(5); + entry->parent_folder_id = s.ColumnInt64(5); entry->url_id = s.ColumnInt64(7); - entry->group_id = s.ColumnInt64(8); + entry->folder_id = s.ColumnInt64(8); entry->date_folder_modified = base::Time::FromInternalValue(s.ColumnInt64(9)); } @@ -132,16 +132,16 @@ bool StarredURLDatabase::GetAllStarredEntries( bool StarredURLDatabase::EnsureStarredIntegrity() { std::set<StarredNode*> roots; - std::set<StarID> groups_with_duplicate_ids; + std::set<StarID> folders_with_duplicate_ids; std::set<StarredNode*> unparented_urls; std::set<StarID> empty_url_ids; - if (!BuildStarNodes(&roots, &groups_with_duplicate_ids, &unparented_urls, + if (!BuildStarNodes(&roots, &folders_with_duplicate_ids, &unparented_urls, &empty_url_ids)) { return false; } - bool valid = EnsureStarredIntegrityImpl(&roots, groups_with_duplicate_ids, + bool valid = EnsureStarredIntegrityImpl(&roots, folders_with_duplicate_ids, &unparented_urls, empty_url_ids); STLDeleteElements(&roots); @@ -151,7 +151,7 @@ bool StarredURLDatabase::EnsureStarredIntegrity() { bool StarredURLDatabase::UpdateStarredEntryRow(StarID star_id, const string16& title, - UIStarID parent_group_id, + UIStarID parent_folder_id, int visual_order, base::Time date_modified) { DCHECK(star_id && visual_order >= 0); @@ -162,17 +162,17 @@ bool StarredURLDatabase::UpdateStarredEntryRow(StarID star_id, return 0; statement.BindString16(0, title); - statement.BindInt64(1, parent_group_id); + statement.BindInt64(1, parent_folder_id); statement.BindInt(2, visual_order); statement.BindInt64(3, date_modified.ToInternalValue()); statement.BindInt64(4, star_id); return statement.Run(); } -bool StarredURLDatabase::AdjustStarredVisualOrder(UIStarID parent_group_id, +bool StarredURLDatabase::AdjustStarredVisualOrder(UIStarID parent_folder_id, int start_visual_order, int delta) { - DCHECK(parent_group_id && start_visual_order >= 0); + DCHECK(parent_folder_id && start_visual_order >= 0); sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, "UPDATE starred SET visual_order=visual_order+? " "WHERE parent_id=? AND visual_order >= ?")); @@ -180,14 +180,14 @@ bool StarredURLDatabase::AdjustStarredVisualOrder(UIStarID parent_group_id, return false; statement.BindInt(0, delta); - statement.BindInt64(1, parent_group_id); + statement.BindInt64(1, parent_folder_id); statement.BindInt(2, start_visual_order); return statement.Run(); } StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id, - UIStarID group_id, - UIStarID parent_group_id, + UIStarID folder_id, + UIStarID parent_folder_id, const string16& title, const base::Time& date_added, int visual_order, @@ -208,7 +208,7 @@ StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id, case history::StarredEntry::BOOKMARK_BAR: statement.BindInt(0, 1); break; - case history::StarredEntry::USER_GROUP: + case history::StarredEntry::USER_FOLDER: statement.BindInt(0, 2); break; case history::StarredEntry::OTHER: @@ -218,11 +218,11 @@ StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id, NOTREACHED(); } statement.BindInt64(1, url_id); - statement.BindInt64(2, group_id); + statement.BindInt64(2, folder_id); statement.BindString16(3, title); statement.BindInt64(4, date_added.ToInternalValue()); statement.BindInt(5, visual_order); - statement.BindInt64(6, parent_group_id); + statement.BindInt64(6, parent_folder_id); statement.BindInt64(7, base::Time().ToInternalValue()); if (statement.Run()) return GetDB().GetLastInsertRowId(); @@ -260,14 +260,14 @@ StarID StarredURLDatabase::CreateStarredEntry(StarredEntry* entry) { entry->id = 0; // Ensure 0 for failure case. // Adjust the visual order when we are inserting it somewhere. - if (entry->parent_group_id) - AdjustStarredVisualOrder(entry->parent_group_id, entry->visual_order, 1); + if (entry->parent_folder_id) + AdjustStarredVisualOrder(entry->parent_folder_id, entry->visual_order, 1); // Insert the new entry. switch (entry->type) { - case StarredEntry::USER_GROUP: - entry->id = CreateStarredEntryRow(0, entry->group_id, - entry->parent_group_id, entry->title, entry->date_added, + case StarredEntry::USER_FOLDER: + entry->id = CreateStarredEntryRow(0, entry->folder_id, + entry->parent_folder_id, entry->title, entry->date_added, entry->visual_order, entry->type); break; @@ -285,8 +285,8 @@ StarID StarredURLDatabase::CreateStarredEntry(StarredEntry* entry) { } // Create the star entry referring to the URL row. - entry->id = CreateStarredEntryRow(entry->url_id, entry->group_id, - entry->parent_group_id, entry->title, entry->date_added, + entry->id = CreateStarredEntryRow(entry->url_id, entry->folder_id, + entry->parent_folder_id, entry->title, entry->date_added, entry->visual_order, entry->type); // Update the URL row to refer to this new starred entry. @@ -301,23 +301,23 @@ StarID StarredURLDatabase::CreateStarredEntry(StarredEntry* entry) { return entry->id; } -UIStarID StarredURLDatabase::GetMaxGroupID() { - sql::Statement max_group_id_statement(GetDB().GetUniqueStatement( +UIStarID StarredURLDatabase::GetMaxFolderID() { + sql::Statement max_folder_id_statement(GetDB().GetUniqueStatement( "SELECT MAX(group_id) FROM starred")); - if (!max_group_id_statement) { + if (!max_folder_id_statement) { NOTREACHED() << GetDB().GetErrorMessage(); return 0; } - if (!max_group_id_statement.Step()) { + if (!max_folder_id_statement.Step()) { NOTREACHED() << GetDB().GetErrorMessage(); return 0; } - return max_group_id_statement.ColumnInt64(0); + return max_folder_id_statement.ColumnInt64(0); } bool StarredURLDatabase::BuildStarNodes( std::set<StarredURLDatabase::StarredNode*>* roots, - std::set<StarID>* groups_with_duplicate_ids, + std::set<StarID>* folders_with_duplicate_ids, std::set<StarredNode*>* unparented_urls, std::set<StarID>* empty_url_ids) { std::vector<StarredEntry> star_entries; @@ -326,18 +326,18 @@ bool StarredURLDatabase::BuildStarNodes( return false; } - // Create the group/bookmark-bar/other nodes. - std::map<UIStarID, StarredNode*> group_id_to_node_map; + // Create the folder/bookmark-bar/other nodes. + std::map<UIStarID, StarredNode*> folder_id_to_node_map; for (size_t i = 0; i < star_entries.size(); ++i) { if (star_entries[i].type != StarredEntry::URL) { - if (group_id_to_node_map.find(star_entries[i].group_id) != - group_id_to_node_map.end()) { - // There's already a group with this ID. - groups_with_duplicate_ids->insert(star_entries[i].id); + if (folder_id_to_node_map.find(star_entries[i].folder_id) != + folder_id_to_node_map.end()) { + // There's already a folder with this ID. + folders_with_duplicate_ids->insert(star_entries[i].id); } else { // Create the node and update the mapping. StarredNode* node = new StarredNode(star_entries[i]); - group_id_to_node_map[star_entries[i].group_id] = node; + folder_id_to_node_map[star_entries[i].folder_id] = node; } } } @@ -350,33 +350,33 @@ bool StarredURLDatabase::BuildStarNodes( if (star_entries[i].type == StarredEntry::URL) { if (star_entries[i].url.is_empty()) { empty_url_ids->insert(star_entries[i].id); - } else if (!star_entries[i].parent_group_id || - group_id_to_node_map.find(star_entries[i].parent_group_id) == - group_id_to_node_map.end()) { + } else if (!star_entries[i].parent_folder_id || + folder_id_to_node_map.find(star_entries[i].parent_folder_id) == + folder_id_to_node_map.end()) { // This entry has no parent, or we couldn't find the parent. StarredNode* node = new StarredNode(star_entries[i]); unparented_urls->insert(node); } else { // Add the node to its parent. StarredNode* parent = - group_id_to_node_map[star_entries[i].parent_group_id]; + folder_id_to_node_map[star_entries[i].parent_folder_id]; StarredNode* node = new StarredNode(star_entries[i]); parent->Add(node, parent->child_count()); } - } else if (groups_with_duplicate_ids->find(star_entries[i].id) == - groups_with_duplicate_ids->end()) { - // The entry is a group (or bookmark bar/other node) that isn't + } else if (folders_with_duplicate_ids->find(star_entries[i].id) == + folders_with_duplicate_ids->end()) { + // The entry is a folder (or bookmark bar/other node) that isn't // marked as a duplicate. - if (!star_entries[i].parent_group_id || - group_id_to_node_map.find(star_entries[i].parent_group_id) == - group_id_to_node_map.end()) { + if (!star_entries[i].parent_folder_id || + folder_id_to_node_map.find(star_entries[i].parent_folder_id) == + folder_id_to_node_map.end()) { // Entry has no parent, or the parent wasn't found. - roots->insert(group_id_to_node_map[star_entries[i].group_id]); + roots->insert(folder_id_to_node_map[star_entries[i].folder_id]); } else { - // Parent the group node. + // Parent the folder node. StarredNode* parent = - group_id_to_node_map[star_entries[i].parent_group_id]; - StarredNode* node = group_id_to_node_map[star_entries[i].group_id]; + folder_id_to_node_map[star_entries[i].parent_folder_id]; + StarredNode* node = folder_id_to_node_map[star_entries[i].folder_id]; if (!node->HasAncestor(parent) && !parent->HasAncestor(node)) { parent->Add(node, parent->child_count()); } else { @@ -408,7 +408,7 @@ bool StarredURLDatabase::EnsureVisualOrder( StarredEntry& entry = node->GetChild(i)->value; entry.visual_order = i; LOG(WARNING) << "Bookmark visual order is wrong"; - if (!UpdateStarredEntryRow(entry.id, entry.title, entry.parent_group_id, + if (!UpdateStarredEntryRow(entry.id, entry.title, entry.parent_folder_id, i, entry.date_folder_modified)) { NOTREACHED() << "Unable to update visual order"; return false; @@ -422,7 +422,7 @@ bool StarredURLDatabase::EnsureVisualOrder( bool StarredURLDatabase::EnsureStarredIntegrityImpl( std::set<StarredURLDatabase::StarredNode*>* roots, - const std::set<StarID>& groups_with_duplicate_ids, + const std::set<StarID>& folders_with_duplicate_ids, std::set<StarredNode*>* unparented_urls, const std::set<StarID>& empty_url_ids) { // Make sure the bookmark bar entry exists. @@ -441,13 +441,13 @@ bool StarredURLDatabase::EnsureStarredIntegrityImpl( if (!other_node) { LOG(WARNING) << "No bookmark other folder in database"; StarredEntry entry; - entry.group_id = GetMaxGroupID() + 1; - if (entry.group_id == 1) { + entry.folder_id = GetMaxFolderID() + 1; + if (entry.folder_id == 1) { NOTREACHED() << "Unable to get new id for other bookmarks folder"; return false; } entry.id = CreateStarredEntryRow( - 0, entry.group_id, 0, UTF8ToUTF16("other"), base::Time::Now(), 0, + 0, entry.folder_id, 0, UTF8ToUTF16("other"), base::Time::Now(), 0, history::StarredEntry::OTHER); if (!entry.id) { NOTREACHED() << "Unable to create other bookmarks folder"; @@ -458,7 +458,7 @@ bool StarredURLDatabase::EnsureStarredIntegrityImpl( roots->insert(other_node); } - // We could potentially make sure only one group with type + // We could potentially make sure only one folder with type // BOOKMARK_BAR/OTHER, but history backend enforces this. // Nuke any entries with no url. @@ -489,23 +489,23 @@ bool StarredURLDatabase::EnsureStarredIntegrityImpl( } } - // Nuke any groups with duplicate ids. A duplicate id means there are two - // folders in the starred table with the same group_id. We only keep the - // first folder, all other groups are removed. - for (std::set<StarID>::const_iterator i = groups_with_duplicate_ids.begin(); - i != groups_with_duplicate_ids.end(); ++i) { - LOG(WARNING) << "Duplicate group id in bookmark database"; + // Nuke any folders with duplicate ids. A duplicate id means there are two + // folders in the starred table with the same folder_id. We only keep the + // first folder, all other folders are removed. + for (std::set<StarID>::const_iterator i = folders_with_duplicate_ids.begin(); + i != folders_with_duplicate_ids.end(); ++i) { + LOG(WARNING) << "Duplicate folder id in bookmark database"; if (!DeleteStarredEntryRow(*i)) { NOTREACHED() << "Unable to delete folder"; return false; } } - // Move unparented user groups back to the bookmark bar. + // Move unparented user folders back to the bookmark bar. { std::set<StarredNode*>::iterator i = roots->begin(); while (i != roots->end()) { - if ((*i)->value.type == StarredEntry::USER_GROUP) { + if ((*i)->value.type == StarredEntry::USER_FOLDER) { LOG(WARNING) << "Bookmark folder not on bookmark bar found"; if (!Move(*i, bookmark_node)) return false; @@ -522,9 +522,9 @@ bool StarredURLDatabase::EnsureStarredIntegrityImpl( bool StarredURLDatabase::Move(StarredNode* source, StarredNode* new_parent) { history::StarredEntry& entry = source->value; entry.visual_order = new_parent->child_count(); - entry.parent_group_id = new_parent->value.group_id; + entry.parent_folder_id = new_parent->value.folder_id; if (!UpdateStarredEntryRow(entry.id, entry.title, - entry.parent_group_id, entry.visual_order, + entry.parent_folder_id, entry.visual_order, entry.date_folder_modified)) { NOTREACHED() << "Unable to move folder"; return false; @@ -547,38 +547,38 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const FilePath& path) { BookmarkNode other_node(0, GURL()); other_node.Reset(entry); - std::map<history::UIStarID, history::StarID> group_id_to_id_map; + std::map<history::UIStarID, history::StarID> folder_id_to_id_map; typedef std::map<history::StarID, BookmarkNode*> IDToNodeMap; IDToNodeMap id_to_node_map; - history::UIStarID other_folder_group_id = 0; + history::UIStarID other_folder_folder_id = 0; history::StarID other_folder_id = 0; - // Iterate through the entries building a mapping between group_id and id. + // Iterate through the entries building a mapping between folder_id and id. for (std::vector<history::StarredEntry>::const_iterator i = entries.begin(); i != entries.end(); ++i) { if (i->type != history::StarredEntry::URL) { - group_id_to_id_map[i->group_id] = i->id; + folder_id_to_id_map[i->folder_id] = i->id; if (i->type == history::StarredEntry::OTHER) { other_folder_id = i->id; - other_folder_group_id = i->group_id; + other_folder_folder_id = i->folder_id; } } } // Register the bookmark bar and other folder nodes in the maps. id_to_node_map[HistoryService::kBookmarkBarID] = &bookmark_bar_node; - group_id_to_id_map[HistoryService::kBookmarkBarID] = + folder_id_to_id_map[HistoryService::kBookmarkBarID] = HistoryService::kBookmarkBarID; - if (other_folder_group_id) { + if (other_folder_folder_id) { id_to_node_map[other_folder_id] = &other_node; - group_id_to_id_map[other_folder_group_id] = other_folder_id; + folder_id_to_id_map[other_folder_folder_id] = other_folder_id; } // Iterate through the entries again creating the nodes. for (std::vector<history::StarredEntry>::iterator i = entries.begin(); i != entries.end(); ++i) { - if (!i->parent_group_id) { + if (!i->parent_folder_id) { DCHECK(i->type == history::StarredEntry::BOOKMARK_BAR || i->type == history::StarredEntry::OTHER); // Only entries with no parent should be the bookmark bar and other @@ -589,7 +589,7 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const FilePath& path) { BookmarkNode* node = id_to_node_map[i->id]; if (!node) { // Creating a node results in creating the parent. As such, it is - // possible for the node representing a group to have been created before + // possible for the node representing a folder to have been created before // encountering the details. // The created nodes are owned by the root node. @@ -598,9 +598,9 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const FilePath& path) { } node->Reset(*i); - DCHECK(group_id_to_id_map.find(i->parent_group_id) != - group_id_to_id_map.end()); - history::StarID parent_id = group_id_to_id_map[i->parent_group_id]; + DCHECK(folder_id_to_id_map.find(i->parent_folder_id) != + folder_id_to_id_map.end()); + history::StarID parent_id = folder_id_to_id_map[i->parent_folder_id]; BookmarkNode* parent = id_to_node_map[parent_id]; if (!parent) { // Haven't encountered the parent yet, create it now. diff --git a/chrome/browser/history/starred_url_database.h b/chrome/browser/history/starred_url_database.h index aff2d64..794b6b3 100644 --- a/chrome/browser/history/starred_url_database.h +++ b/chrome/browser/history/starred_url_database.h @@ -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. @@ -37,7 +37,7 @@ class StarredURLDatabase : public URLDatabase { // The unit tests poke our innards. friend class HistoryTest; friend class StarredURLDatabaseTest; - FRIEND_TEST_ALL_PREFIXES(HistoryTest, CreateStarGroup); + FRIEND_TEST_ALL_PREFIXES(HistoryTest, CreateStarFolder); // Writes bookmarks to the specified file. bool MigrateBookmarksToFile(const FilePath& path); @@ -66,21 +66,21 @@ class StarredURLDatabase : public URLDatabase { // Gets all the starred entries. bool GetAllStarredEntries(std::vector<StarredEntry>* entries); - // Sets the title, parent_id, parent_group_id, visual_order and date_modifed + // Sets the title, parent_id, parent_folder_id, visual_order and date_modifed // of the specified star entry. // // WARNING: Does not update the visual order. bool UpdateStarredEntryRow(StarID star_id, const string16& title, - UIStarID parent_group_id, + UIStarID parent_folder_id, int visual_order, base::Time date_modified); - // Adjusts the visual order of all children of parent_group_id with a + // Adjusts the visual order of all children of parent_folder_id with a // visual_order >= start_visual_order by delta. For example, // AdjustStarredVisualOrder(10, 0, 1) increments the visual order all children - // of group 10 with a visual order >= 0 by 1. - bool AdjustStarredVisualOrder(UIStarID parent_group_id, + // of folder 10 with a visual order >= 0 by 1. + bool AdjustStarredVisualOrder(UIStarID parent_folder_id, int start_visual_order, int delta); @@ -89,8 +89,8 @@ class StarredURLDatabase : public URLDatabase { // // WARNING: Does not update the visual order. StarID CreateStarredEntryRow(URLID url_id, - UIStarID group_id, - UIStarID parent_group_id, + UIStarID folder_id, + UIStarID parent_folder_id, const string16& title, const base::Time& date_added, int visual_order, @@ -117,16 +117,16 @@ class StarredURLDatabase : public URLDatabase { // Used when checking integrity of starred table. typedef ui::TreeNodeWithValue<history::StarredEntry> StarredNode; - // Returns the max group id, or 0 if there is an error. - UIStarID GetMaxGroupID(); + // Returns the max folder id, or 0 if there is an error. + UIStarID GetMaxFolderID(); // Gets all the bookmarks and folders creating a StarredNode for each // bookmark and folder. On success all the root nodes (bookmark bar node, // other folder node, folders with no parent or folders with a parent that // would make a cycle) are added to roots. // - // If a group_id occurs more than once, all but the first ones id is added to - // groups_with_duplicate_ids. + // If a folder_id occurs more than once, all but the first ones id is added to + // folders_with_duplicate_ids. // // All bookmarks not on the bookmark bar/other folder are added to // unparented_urls. @@ -137,7 +137,7 @@ class StarredURLDatabase : public URLDatabase { // This is used during integrity enforcing/checking of the starred table. bool BuildStarNodes( std::set<StarredNode*>* roots, - std::set<StarID>* groups_with_duplicate_ids, + std::set<StarID>* folders_with_duplicate_ids, std::set<StarredNode*>* unparented_urls, std::set<StarID>* empty_url_ids); @@ -163,11 +163,11 @@ class StarredURLDatabase : public URLDatabase { // couldn't be repaired. bool EnsureStarredIntegrityImpl( std::set<StarredNode*>* roots, - const std::set<StarID>& groups_with_duplicate_ids, + const std::set<StarID>& folders_with_duplicate_ids, std::set<StarredNode*>* unparented_urls, const std::set<StarID>& empty_url_ids); - // Resets the visual order and parent_group_id of source's StarredEntry + // Resets the visual order and parent_folder_id of source's StarredEntry // and adds it to the end of new_parent's children. // // This is used if the starred table is an unexpected state and an entry diff --git a/chrome/browser/history/starred_url_database_unittest.cc b/chrome/browser/history/starred_url_database_unittest.cc index deb9750..5bf0e22 100644 --- a/chrome/browser/history/starred_url_database_unittest.cc +++ b/chrome/browser/history/starred_url_database_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. @@ -34,8 +34,8 @@ class StarredURLDatabaseTest : public testing::Test, EXPECT_EQ(entry.id, db_value.id); EXPECT_TRUE(entry.title == db_value.title); EXPECT_EQ(entry.date_added.ToTimeT(), db_value.date_added.ToTimeT()); - EXPECT_EQ(entry.group_id, db_value.group_id); - EXPECT_EQ(entry.parent_group_id, db_value.parent_group_id); + EXPECT_EQ(entry.folder_id, db_value.folder_id); + EXPECT_EQ(entry.parent_folder_id, db_value.parent_folder_id); EXPECT_EQ(entry.visual_order, db_value.visual_order); EXPECT_EQ(entry.type, db_value.type); EXPECT_EQ(entry.url_id, db_value.url_id); @@ -100,15 +100,15 @@ class StarredURLDatabaseTest : public testing::Test, //----------------------------------------------------------------------------- -TEST_F(StarredURLDatabaseTest, FixOrphanedGroup) { +TEST_F(StarredURLDatabaseTest, FixOrphanedFolder) { const int initial_count = GetStarredEntryCount(); - // Create a group that isn't parented to the other/bookmark folders. + // Create a folder that isn't parented to the other/bookmark folders. StarredEntry g_entry; - g_entry.type = StarredEntry::USER_GROUP; - g_entry.parent_group_id = 100; + g_entry.type = StarredEntry::USER_FOLDER; + g_entry.parent_folder_id = 100; g_entry.visual_order = 10; - g_entry.group_id = 100; + g_entry.folder_id = 100; CreateStarredEntry(&g_entry); ASSERT_TRUE(EnsureStarredIntegrity()); @@ -116,9 +116,9 @@ TEST_F(StarredURLDatabaseTest, FixOrphanedGroup) { // Make sure no new entries were added. ASSERT_EQ(initial_count + 1, GetStarredEntryCount()); - // Make sure the group was moved to the bookmark bar folder. + // Make sure the folder was moved to the bookmark bar folder. ASSERT_TRUE(GetStarredEntry(g_entry.id, &g_entry)); - ASSERT_EQ(HistoryService::kBookmarkBarID, g_entry.parent_group_id); + ASSERT_EQ(HistoryService::kBookmarkBarID, g_entry.parent_folder_id); ASSERT_EQ(0, g_entry.visual_order); } @@ -127,13 +127,13 @@ TEST_F(StarredURLDatabaseTest, FixOrphanedBookmarks) { // Create two bookmarks that aren't in a random folder no on the bookmark bar. StarredEntry entry1; - entry1.parent_group_id = 100; + entry1.parent_folder_id = 100; entry1.visual_order = 10; entry1.url = GURL("http://google.com/1"); CreateStarredEntry(&entry1); StarredEntry entry2; - entry2.parent_group_id = 101; + entry2.parent_folder_id = 101; entry2.visual_order = 20; entry2.url = GURL("http://google.com/2"); CreateStarredEntry(&entry2); @@ -146,22 +146,22 @@ TEST_F(StarredURLDatabaseTest, FixOrphanedBookmarks) { // Make sure the entries were moved to the bookmark bar and the visual order // order was updated appropriately. ASSERT_TRUE(GetStarredEntry(entry1.id, &entry1)); - ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_group_id); + ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_folder_id); ASSERT_TRUE(GetStarredEntry(entry2.id, &entry2)); - ASSERT_EQ(HistoryService::kBookmarkBarID, entry2.parent_group_id); + ASSERT_EQ(HistoryService::kBookmarkBarID, entry2.parent_folder_id); ASSERT_TRUE((entry1.visual_order == 0 && entry2.visual_order == 1) || (entry1.visual_order == 1 && entry2.visual_order == 0)); } -TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth0) { +TEST_F(StarredURLDatabaseTest, FixFolderCycleDepth0) { const int initial_count = GetStarredEntryCount(); - // Create a group that is parented to itself. + // Create a folder that is parented to itself. StarredEntry entry1; - entry1.group_id = entry1.parent_group_id = 100; + entry1.folder_id = entry1.parent_folder_id = 100; entry1.visual_order = 10; - entry1.type = StarredEntry::USER_GROUP; + entry1.type = StarredEntry::USER_FOLDER; CreateStarredEntry(&entry1); ASSERT_TRUE(EnsureStarredIntegrity()); @@ -169,28 +169,28 @@ TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth0) { // Make sure no new entries were added. ASSERT_EQ(initial_count + 1, GetStarredEntryCount()); - // Make sure the group were moved to the bookmark bar and the visual order + // Make sure the folder were moved to the bookmark bar and the visual order // order was updated appropriately. ASSERT_TRUE(GetStarredEntry(entry1.id, &entry1)); - ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_group_id); + ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_folder_id); ASSERT_EQ(0, entry1.visual_order); } -TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth1) { +TEST_F(StarredURLDatabaseTest, FixFolderCycleDepth1) { const int initial_count = GetStarredEntryCount(); StarredEntry entry1; - entry1.group_id = 100; - entry1.parent_group_id = 101; + entry1.folder_id = 100; + entry1.parent_folder_id = 101; entry1.visual_order = 10; - entry1.type = StarredEntry::USER_GROUP; + entry1.type = StarredEntry::USER_FOLDER; CreateStarredEntry(&entry1); StarredEntry entry2; - entry2.group_id = 101; - entry2.parent_group_id = 100; + entry2.folder_id = 101; + entry2.parent_folder_id = 100; entry2.visual_order = 11; - entry2.type = StarredEntry::USER_GROUP; + entry2.type = StarredEntry::USER_FOLDER; CreateStarredEntry(&entry2); ASSERT_TRUE(EnsureStarredIntegrity()); @@ -198,12 +198,12 @@ TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth1) { // Make sure no new entries were added. ASSERT_EQ(initial_count + 2, GetStarredEntryCount()); - // Because the groups caused a cycle, entry1 is moved the bookmark bar, which + // Because the folders caused a cycle, entry1 is moved the bookmark bar, which // breaks the cycle. ASSERT_TRUE(GetStarredEntry(entry1.id, &entry1)); ASSERT_TRUE(GetStarredEntry(entry2.id, &entry2)); - ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_group_id); - ASSERT_EQ(100, entry2.parent_group_id); + ASSERT_EQ(HistoryService::kBookmarkBarID, entry1.parent_folder_id); + ASSERT_EQ(100, entry2.parent_folder_id); ASSERT_EQ(0, entry1.visual_order); ASSERT_EQ(0, entry2.visual_order); } @@ -214,14 +214,14 @@ TEST_F(StarredURLDatabaseTest, FixVisualOrder) { // Star two urls. StarredEntry entry1; entry1.url = GURL("http://google.com/1"); - entry1.parent_group_id = HistoryService::kBookmarkBarID; + entry1.parent_folder_id = HistoryService::kBookmarkBarID; entry1.visual_order = 5; CreateStarredEntry(&entry1); // Add url2 and star it. StarredEntry entry2; entry2.url = GURL("http://google.com/2"); - entry2.parent_group_id = HistoryService::kBookmarkBarID; + entry2.parent_folder_id = HistoryService::kBookmarkBarID; entry2.visual_order = 10; CreateStarredEntry(&entry2); @@ -240,21 +240,21 @@ TEST_F(StarredURLDatabaseTest, FixVisualOrder) { CompareEntryByID(entry2); } -TEST_F(StarredURLDatabaseTest, FixDuplicateGroupIDs) { +TEST_F(StarredURLDatabaseTest, FixDuplicateFolderIDs) { const int initial_count = GetStarredEntryCount(); - // Create two groups with the same group id. + // Create two folders with the same folder id. StarredEntry entry1; - entry1.type = StarredEntry::USER_GROUP; - entry1.group_id = 10; - entry1.parent_group_id = HistoryService::kBookmarkBarID; + entry1.type = StarredEntry::USER_FOLDER; + entry1.folder_id = 10; + entry1.parent_folder_id = HistoryService::kBookmarkBarID; CreateStarredEntry(&entry1); StarredEntry entry2 = entry1; CreateStarredEntry(&entry2); ASSERT_TRUE(EnsureStarredIntegrity()); - // Make sure only one group exists. + // Make sure only one folder exists. ASSERT_EQ(initial_count + 1, GetStarredEntryCount()); StarredEntry entry; @@ -268,7 +268,7 @@ TEST_F(StarredURLDatabaseTest, RemoveStarredEntriesWithEmptyURL) { StarredEntry entry; entry.url = GURL("http://google.com"); entry.title = UTF8ToUTF16("FOO"); - entry.parent_group_id = HistoryService::kBookmarkBarID; + entry.parent_folder_id = HistoryService::kBookmarkBarID; ASSERT_NE(0, CreateStarredEntry(&entry)); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller_unittest.mm index a7dd746..bb0dc31 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller_unittest.mm @@ -38,22 +38,22 @@ class BookmarkAllTabsControllerTest : public CocoaTest { BrowserTestHelper helper_; const BookmarkNode* parent_node_; BookmarkAllTabsControllerOverride* controller_; - const BookmarkNode* group_a_; + const BookmarkNode* folder_a_; BookmarkAllTabsControllerTest() { BookmarkModel& model(*(helper_.profile()->GetBookmarkModel())); const BookmarkNode* root = model.GetBookmarkBarNode(); - group_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a")); - model.AddURL(group_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com")); - model.AddURL(group_a_, 1, ASCIIToUTF16("a-1"), GURL("http://a-1.com")); - model.AddURL(group_a_, 2, ASCIIToUTF16("a-2"), GURL("http://a-2.com")); + folder_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a")); + model.AddURL(folder_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com")); + model.AddURL(folder_a_, 1, ASCIIToUTF16("a-1"), GURL("http://a-1.com")); + model.AddURL(folder_a_, 2, ASCIIToUTF16("a-2"), GURL("http://a-2.com")); } virtual BookmarkAllTabsControllerOverride* CreateController() { return [[BookmarkAllTabsControllerOverride alloc] initWithParentWindow:test_window() profile:helper_.profile() - parent:group_a_ + parent:folder_a_ configuration:BookmarkEditor::SHOW_TREE]; } @@ -72,11 +72,11 @@ class BookmarkAllTabsControllerTest : public CocoaTest { TEST_F(BookmarkAllTabsControllerTest, BookmarkAllTabs) { // OK button should always be enabled. EXPECT_TRUE([controller_ okButtonEnabled]); - [controller_ selectTestNodeInBrowser:group_a_]; + [controller_ selectTestNodeInBrowser:folder_a_]; [controller_ setDisplayName:@"ALL MY TABS"]; [controller_ ok:nil]; - EXPECT_EQ(4, group_a_->child_count()); - const BookmarkNode* folderChild = group_a_->GetChild(3); + EXPECT_EQ(4, folder_a_->child_count()); + const BookmarkNode* folderChild = folder_a_->GetChild(3); EXPECT_EQ(folderChild->GetTitle(), ASCIIToUTF16("ALL MY TABS")); EXPECT_EQ(3, folderChild->child_count()); } 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 6aec03f..a930b72 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm @@ -369,7 +369,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkURLInPlace) { ASSERT_EQ(3, childIndex); } -TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkGroup) { +TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkFolder) { [controller_ selectTestNodeInBrowser:folder_c_]; [controller_ ok:nil]; UpdateBB3(); @@ -379,7 +379,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeBookmarkGroup) { ASSERT_EQ(4, childIndex); } -TEST_F(BookmarkEditorControllerTreeTest, ChangeNameAndBookmarkGroup) { +TEST_F(BookmarkEditorControllerTreeTest, ChangeNameAndBookmarkFolder) { [controller_ setDisplayName:@"NEW NAME"]; [controller_ selectTestNodeInBrowser:folder_c_]; [controller_ ok:nil]; @@ -391,7 +391,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeNameAndBookmarkGroup) { EXPECT_EQ(bookmark_bb_3_->GetTitle(), ASCIIToUTF16("NEW NAME")); } -TEST_F(BookmarkEditorControllerTreeTest, AddFolderWithGroupSelected) { +TEST_F(BookmarkEditorControllerTreeTest, AddFolderWithFolderSelected) { // Folders are NOT added unless the OK button is pressed. [controller_ newFolder:nil]; [controller_ cancel:nil]; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h index cbd7b8c..7a74c79 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h @@ -133,7 +133,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate, // Helper function which destroys all the bookmark buttons in the GtkToolbar. void RemoveAllBookmarkButtons(); - // Returns the number of buttons corresponding to starred urls/groups. This + // Returns the number of buttons corresponding to starred urls/folders. This // is equivalent to the number of children the bookmark bar node from the // bookmark bar model has. int GetBookmarkButtonCount(); @@ -309,7 +309,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate, // Provides us with the offset into the background theme image. TabstripOriginProvider* tabstrip_origin_provider_; - // Model providing details as to the starred entries/groups that should be + // Model providing details as to the starred entries/folders that should be // shown. This is owned by the Profile. BookmarkModel* model_; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc index 5ed9485..cab8b1d 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc @@ -458,7 +458,7 @@ void BookmarkEditorGtk::ApplyEdits(GtkTreeIter* selected_parent) { string16 new_title(GetInputTitle()); if (!show_tree_ || !selected_parent) { - bookmark_utils::ApplyEditsWithNoGroupChange( + bookmark_utils::ApplyEditsWithNoFolderChange( bb_model_, parent_, details_, new_title, new_url); return; } @@ -474,7 +474,7 @@ void BookmarkEditorGtk::ApplyEdits(GtkTreeIter* selected_parent) { return; } - bookmark_utils::ApplyEditsWithPossibleGroupChange( + bookmark_utils::ApplyEditsWithPossibleFolderChange( bb_model_, new_parent, details_, new_title, new_url); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 96b0265..f34369fb 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -265,7 +265,7 @@ struct BookmarkBarView::DropInfo { // If true, the menu is being shown. bool is_menu_showing; - // If true, the user is dropping on a node. This is only used for group + // If true, the user is dropping on a node. This is only used for folder // nodes. bool drop_on; @@ -326,8 +326,8 @@ const int BookmarkBarView::kNewtabVerticalPadding = 12; // static bool BookmarkBarView::testing_ = false; -// Returns the bitmap to use for starred groups. -static const SkBitmap& GetGroupIcon() { +// Returns the bitmap to use for starred folders. +static const SkBitmap& GetFolderIcon() { if (!kFolderIcon) { kFolderIcon = ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); @@ -891,7 +891,7 @@ MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { this, false); button->SetID(VIEW_ID_OTHER_BOOKMARKS); - button->SetIcon(GetGroupIcon()); + button->SetIcon(GetFolderIcon()); button->SetContextMenuController(this); button->set_tag(kOtherFolderButtonTag); button->SetAccessibleName( @@ -1249,7 +1249,7 @@ views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { } else { views::MenuButton* button = new BookmarkFolderButton(this, UTF16ToWide(node->GetTitle()), this, false); - button->SetIcon(GetGroupIcon()); + button->SetIcon(GetFolderIcon()); ConfigureButton(node, button); return button; } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h index d64295d..4ec60e3 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -235,7 +235,7 @@ class BookmarkBarView : public DetachableToolbarView, // throbs. void StopThrobbing(bool immediate); - // Returns the number of buttons corresponding to starred urls/groups. This + // Returns the number of buttons corresponding to starred urls/folders. This // is equivalent to the number of children the bookmark bar node from the // bookmark bar model has. int GetBookmarkButtonCount(); @@ -469,16 +469,16 @@ class BookmarkBarView : public DetachableToolbarView, // Used for opening urls. PageNavigator* page_navigator_; - // Model providing details as to the starred entries/groups that should be + // Model providing details as to the starred entries/folders that should be // shown. This is owned by the Profile. BookmarkModel* model_; // Used to manage showing a Menu, either for the most recently bookmarked - // entries, or for the a starred group. + // entries, or for the starred folder. BookmarkMenuController* bookmark_menu_; // Used when showing a menu for drag and drop. That is, if the user drags - // over a group this becomes non-null and manages the menu showing the + // over a folder this becomes non-null and manages the menu showing the // contents of the node. BookmarkMenuController* bookmark_drop_menu_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index e074d74..b8e25ef 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -542,7 +542,7 @@ void BookmarkEditorView::ApplyEdits(EditorNode* parent) { string16 new_title(WideToUTF16Hack(GetInputTitle())); if (!show_tree_) { - bookmark_utils::ApplyEditsWithNoGroupChange( + bookmark_utils::ApplyEditsWithNoFolderChange( bb_model_, parent_, details_, new_title, new_url); return; } @@ -552,7 +552,7 @@ void BookmarkEditorView::ApplyEdits(EditorNode* parent) { ApplyNameChangesAndCreateNewFolders( bb_model_->root_node(), tree_model_->GetRoot(), parent, &new_parent); - bookmark_utils::ApplyEditsWithPossibleGroupChange( + bookmark_utils::ApplyEditsWithPossibleFolderChange( bb_model_, new_parent, details_, new_title, new_url); } 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 657176a..f2907d7 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc @@ -142,7 +142,7 @@ bool BookmarkMenuController::CanDrop(MenuItemView* menu, const BookmarkNode* drag_node = drop_data_.GetFirstNode(profile_); if (!drag_node) { - // Dragging a group from another profile, always accept. + // Dragging a folder from another profile, always accept. return true; } diff --git a/chrome/test/live_sync/bookmark_model_verifier.cc b/chrome/test/live_sync/bookmark_model_verifier.cc index 1a644e8..3a34a93 100644 --- a/chrome/test/live_sync/bookmark_model_verifier.cc +++ b/chrome/test/live_sync/bookmark_model_verifier.cc @@ -328,11 +328,11 @@ const BookmarkNode* BookmarkModelVerifier::SetURL(BookmarkModel* model, if (use_verifier_model_) { const BookmarkNode* v_node = NULL; FindNodeInVerifier(model, node, &v_node); - bookmark_utils::ApplyEditsWithNoGroupChange( + bookmark_utils::ApplyEditsWithNoFolderChange( verifier_model_, v_node->parent(), BookmarkEditor::EditDetails(v_node), v_node->GetTitle(), new_url); } - return bookmark_utils::ApplyEditsWithNoGroupChange( + return bookmark_utils::ApplyEditsWithNoFolderChange( model, node->parent(), BookmarkEditor::EditDetails(node), node->GetTitle(), new_url); } |