diff options
71 files changed, 191 insertions, 205 deletions
diff --git a/app/tree_model.h b/app/tree_model.h index d2e37b1..df06b9f 100644 --- a/app/tree_model.h +++ b/app/tree_model.h @@ -6,7 +6,6 @@ #define APP_TREE_MODEL_H_ #pragma once -#include <string> #include <vector> #include "base/logging.h" @@ -22,9 +21,7 @@ class TreeModel; class TreeModelNode { public: // Returns the title for the node. - // TODO(viettrungluu): remove wstring version and rename string16 version. - virtual std::wstring GetTitle() const = 0; - virtual const string16& GetTitleAsString16() const = 0; + virtual const string16& GetTitle() const = 0; protected: virtual ~TreeModelNode() {} diff --git a/app/tree_node_model.h b/app/tree_node_model.h index 83e55c9..ac6475b 100644 --- a/app/tree_node_model.h +++ b/app/tree_node_model.h @@ -7,7 +7,6 @@ #pragma once #include <algorithm> -#include <string> #include <vector> #include "app/tree_model.h" @@ -17,7 +16,6 @@ #include "base/scoped_vector.h" #include "base/stl_util-inl.h" #include "base/string16.h" -#include "base/utf_string_conversions.h" // TreeNodeModel and TreeNodes provide an implementation of TreeModel around // TreeNodes. TreeNodes form a directed acyclic graph. @@ -71,11 +69,6 @@ class TreeNode : public TreeModelNode { public: TreeNode() : parent_(NULL) { } - // TODO(munjal): Remove wstring overload once all code is moved to string16. -#if !defined(WCHAR_T_IS_UTF16) - explicit TreeNode(const std::wstring& title) - : title_(WideToUTF16(title)), parent_(NULL) {} -#endif explicit TreeNode(const string16& title) : title_(title), parent_(NULL) {} @@ -162,13 +155,8 @@ class TreeNode : public TreeModelNode { title_ = string; } - // TODO(munjal): Remove wstring version and rename GetTitleAsString16 to - // GetTitle once all code is moved to string16. // Returns the title of the node. - virtual std::wstring GetTitle() const { - return UTF16ToWide(title_); - } - virtual const string16& GetTitleAsString16() const { + virtual const string16& GetTitle() const { return title_; } diff --git a/app/tree_node_model_unittest.cc b/app/tree_node_model_unittest.cc index 17592495..4621d94 100644 --- a/app/tree_node_model_unittest.cc +++ b/app/tree_node_model_unittest.cc @@ -287,5 +287,5 @@ TEST_F(TreeNodeModelTest, SetTitle) { const string16 title(ASCIIToUTF16("root2")); model.SetTitle(root, title); AssertObserverCount(0, 0, 1); - EXPECT_EQ(title, root->GetTitleAsString16()); + EXPECT_EQ(title, root->GetTitle()); } diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc index 3e4917a..da748d7 100644 --- a/chrome/browser/autocomplete/history_contents_provider.cc +++ b/chrome/browser/autocomplete/history_contents_provider.cc @@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/histogram.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/history/query_parser.h" @@ -278,6 +279,6 @@ void HistoryContentsProvider::QueryBookmarks(const AutocompleteInput& input) { void HistoryContentsProvider::AddBookmarkTitleMatchToResults( const bookmark_utils::TitleMatch& match) { history::URLResult url_result(match.node->GetURL(), match.match_positions); - url_result.set_title(WideToUTF16(match.node->GetTitle())); + url_result.set_title(match.node->GetTitle()); results_.AppendURLBySwapping(&url_result); } diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc index 1b0dd45..a4f0461 100644 --- a/chrome/browser/bookmarks/bookmark_codec.cc +++ b/chrome/browser/bookmarks/bookmark_codec.cc @@ -87,7 +87,7 @@ Value* BookmarkCodec::EncodeNode(const BookmarkNode* node) { DictionaryValue* value = new DictionaryValue(); std::string id = base::Int64ToString(node->id()); value->SetString(kIdKey, id); - const string16& title = node->GetTitleAsString16(); + const string16& title = node->GetTitle(); value->SetString(kNameKey, title); value->SetString(kDateAddedKey, base::Int64ToString(node->date_added().ToInternalValue())); diff --git a/chrome/browser/bookmarks/bookmark_drag_data.cc b/chrome/browser/bookmarks/bookmark_drag_data.cc index 0862402..accc8c6 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data.cc @@ -24,7 +24,7 @@ const char* BookmarkDragData::kClipboardFormatString = BookmarkDragData::Element::Element(const BookmarkNode* node) : is_url(node->is_url()), url(node->GetURL()), - title(node->GetTitleAsString16()), + title(node->GetTitle()), id_(node->id()) { for (int i = 0; i < node->GetChildCount(); ++i) children.push_back(Element(node->GetChild(i))); diff --git a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc index af98213..0e2c2b7 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc @@ -126,8 +126,7 @@ TEST_F(BookmarkDragDataTest, Group) { BookmarkDragData drag_data(g12); EXPECT_TRUE(drag_data.is_valid()); ASSERT_EQ(1, drag_data.elements.size()); - EXPECT_EQ(g12->GetTitleAsString16(), - WideToUTF16Hack(drag_data.elements[0].title)); + EXPECT_EQ(g12->GetTitle(), WideToUTF16Hack(drag_data.elements[0].title)); EXPECT_FALSE(drag_data.elements[0].is_url); OSExchangeData data; @@ -139,8 +138,7 @@ TEST_F(BookmarkDragDataTest, Group) { EXPECT_TRUE(read_data.Read(data2)); EXPECT_TRUE(read_data.is_valid()); ASSERT_EQ(1, read_data.elements.size()); - EXPECT_EQ(g12->GetTitleAsString16(), - WideToUTF16Hack(read_data.elements[0].title)); + EXPECT_EQ(g12->GetTitle(), WideToUTF16Hack(read_data.elements[0].title)); EXPECT_FALSE(read_data.elements[0].is_url); // We should get back the same node when asking for the same profile. diff --git a/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc b/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc index a2cd475..1844fd8 100644 --- a/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc +++ b/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc @@ -47,7 +47,7 @@ BookmarkFolderEditorController::BookmarkFolderEditorController( l10n_util::GetString(IDS_BOOMARK_BAR_EDIT_FOLDER_LABEL); std::wstring contents = IsNew() ? l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME) : - UTF16ToWide(node_->GetTitleAsString16()); + UTF16ToWide(node_->GetTitle()); dialog_ = InputWindowDialog::Create(wnd, title, label, contents, this); model_->AddObserver(this); diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index ccea3c3..359fc3a 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -27,7 +27,7 @@ BookmarkIndex::NodeSet::const_iterator BookmarkIndex::Match::nodes_end() const { void BookmarkIndex::Add(const BookmarkNode* node) { if (!node->is_url()) return; - std::vector<string16> terms = ExtractQueryWords(node->GetTitleAsString16()); + std::vector<string16> terms = ExtractQueryWords(node->GetTitle()); for (size_t i = 0; i < terms.size(); ++i) RegisterNode(terms[i], node); } @@ -36,7 +36,7 @@ void BookmarkIndex::Remove(const BookmarkNode* node) { if (!node->is_url()) return; - std::vector<string16> terms = ExtractQueryWords(node->GetTitleAsString16()); + std::vector<string16> terms = ExtractQueryWords(node->GetTitle()); for (size_t i = 0; i < terms.size(); ++i) UnregisterNode(terms[i], node); } @@ -116,7 +116,7 @@ void BookmarkIndex::AddMatchToResults( // of QueryParser may filter it out. For example, the query // ["thi"] will match the bookmark titled [Thinking], but since // ["thi"] is quoted we don't want to do a prefix match. - if (parser->DoesQueryMatch(node->GetTitleAsString16(), query_nodes, + if (parser->DoesQueryMatch(node->GetTitle(), query_nodes, &(title_match.match_positions))) { title_match.node = node; results->push_back(title_match); diff --git a/chrome/browser/bookmarks/bookmark_index_unittest.cc b/chrome/browser/bookmarks/bookmark_index_unittest.cc index d83587f..a421ad9 100644 --- a/chrome/browser/bookmarks/bookmark_index_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_index_unittest.cc @@ -54,8 +54,7 @@ class BookmarkIndexTest : public testing::Test { for (size_t i = 0; i < expected_titles.size(); ++i) { bool found = false; for (size_t j = 0; j < matches.size(); ++j) { - if (ASCIIToUTF16(expected_titles[i]) == - matches[j].node->GetTitleAsString16()) { + if (ASCIIToUTF16(expected_titles[i]) == matches[j].node->GetTitle()) { matches.erase(matches.begin() + j); found = true; break; diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index c5bc62f..288c4a8 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -93,10 +93,10 @@ class SortComparator : public std::binary_function<const BookmarkNode*, if (n1->type() == n2->type()) { // Types are the same, compare the names. if (!collator_) - return n1->GetTitleAsString16() < n2->GetTitleAsString16(); + return n1->GetTitle() < n2->GetTitle(); return l10n_util::CompareStringWithCollator(collator_, - UTF16ToWideHack(n1->GetTitleAsString16()), - UTF16ToWideHack(n2->GetTitleAsString16())) == UCOL_LESS; + UTF16ToWideHack(n1->GetTitle()), UTF16ToWideHack(n2->GetTitle())) == + UCOL_LESS; } // Types differ, sort such that folders come first. return n1->is_folder(); @@ -247,7 +247,7 @@ void BookmarkModel::SetTitle(const BookmarkNode* node, const string16& title) { NOTREACHED(); return; } - if (node->GetTitleAsString16() == title) + if (node->GetTitle() == title) return; if (node == bookmark_bar_node_ || node == other_node_) { diff --git a/chrome/browser/bookmarks/bookmark_model_test_utils.cc b/chrome/browser/bookmarks/bookmark_model_test_utils.cc index 263e42f..e5b2a70 100644 --- a/chrome/browser/bookmarks/bookmark_model_test_utils.cc +++ b/chrome/browser/bookmarks/bookmark_model_test_utils.cc @@ -15,7 +15,7 @@ void BookmarkModelTestUtils::AssertNodesEqual(const BookmarkNode* expected, ASSERT_TRUE(actual); if (check_ids) EXPECT_EQ(expected->id(), actual->id()); - EXPECT_EQ(expected->GetTitleAsString16(), actual->GetTitleAsString16()); + EXPECT_EQ(expected->GetTitle(), actual->GetTitle()); EXPECT_EQ(expected->type(), actual->type()); EXPECT_TRUE(expected->date_added() == actual->date_added()); if (expected->type() == BookmarkNode::URL) { diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 66459c7..0bf7534 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -186,7 +186,7 @@ TEST_F(BookmarkModelTest, AddURL) { observer_details.AssertEquals(root, NULL, 0, -1); ASSERT_EQ(1, root->GetChildCount()); - ASSERT_EQ(title, new_node->GetTitleAsString16()); + ASSERT_EQ(title, new_node->GetTitle()); ASSERT_TRUE(url == new_node->GetURL()); ASSERT_EQ(BookmarkNode::URL, new_node->type()); ASSERT_TRUE(new_node == model.GetMostRecentlyAddedNodeForURL(url)); @@ -204,7 +204,7 @@ TEST_F(BookmarkModelTest, AddGroup) { observer_details.AssertEquals(root, NULL, 0, -1); ASSERT_EQ(1, root->GetChildCount()); - ASSERT_EQ(title, new_node->GetTitleAsString16()); + ASSERT_EQ(title, new_node->GetTitle()); ASSERT_EQ(BookmarkNode::FOLDER, new_node->type()); EXPECT_TRUE(new_node->id() != root->id() && @@ -268,7 +268,7 @@ TEST_F(BookmarkModelTest, SetTitle) { model.SetTitle(node, title); AssertObserverCount(0, 0, 0, 1, 0); observer_details.AssertEquals(node, NULL, -1, -1); - EXPECT_EQ(title, node->GetTitleAsString16()); + EXPECT_EQ(title, node->GetTitle()); } TEST_F(BookmarkModelTest, SetURL) { @@ -633,11 +633,11 @@ static void PopulateBookmarkNode(TestNode* parent, TestNode* child = parent->GetChild(i); if (child->value == BookmarkNode::FOLDER) { const BookmarkNode* new_bb_node = - model->AddGroup(bb_node, i, child->GetTitleAsString16()); + model->AddGroup(bb_node, i, child->GetTitle()); PopulateBookmarkNode(child, model, new_bb_node); } else { - model->AddURL(bb_node, i, child->GetTitleAsString16(), - GURL("http://" + UTF16ToASCII(child->GetTitleAsString16()))); + model->AddURL(bb_node, i, child->GetTitle(), + GURL("http://" + UTF16ToASCII(child->GetTitle()))); } } } @@ -670,8 +670,7 @@ class BookmarkModelTestWithProfile : public testing::Test, for (int i = 0; i < expected->GetChildCount(); ++i) { TestNode* expected_child = expected->GetChild(i); const BookmarkNode* actual_child = actual->GetChild(i); - ASSERT_EQ(expected_child->GetTitleAsString16(), - actual_child->GetTitleAsString16()); + ASSERT_EQ(expected_child->GetTitle(), actual_child->GetTitle()); if (expected_child->value == BookmarkNode::FOLDER) { ASSERT_TRUE(actual_child->type() == BookmarkNode::FOLDER); // Recurse throught children. @@ -818,30 +817,29 @@ class BookmarkModelTestWithProfile2 : public BookmarkModelTestWithProfile { const BookmarkNode* child = bbn->GetChild(0); ASSERT_EQ(BookmarkNode::URL, child->type()); - ASSERT_EQ(ASCIIToUTF16("Google"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("Google"), child->GetTitle()); ASSERT_TRUE(child->GetURL() == GURL("http://www.google.com")); child = bbn->GetChild(1); ASSERT_TRUE(child->is_folder()); - ASSERT_EQ(ASCIIToUTF16("F1"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F1"), child->GetTitle()); ASSERT_EQ(2, child->GetChildCount()); const BookmarkNode* parent = child; child = parent->GetChild(0); ASSERT_EQ(BookmarkNode::URL, child->type()); - ASSERT_EQ(ASCIIToUTF16("Google Advertising"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("Google Advertising"), child->GetTitle()); ASSERT_TRUE(child->GetURL() == GURL("http://www.google.com/intl/en/ads/")); child = parent->GetChild(1); ASSERT_TRUE(child->is_folder()); - ASSERT_EQ(ASCIIToUTF16("F11"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F11"), child->GetTitle()); ASSERT_EQ(1, child->GetChildCount()); parent = child; child = parent->GetChild(0); ASSERT_EQ(BookmarkNode::URL, child->type()); - ASSERT_EQ(ASCIIToUTF16("Google Business Solutions"), - child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("Google Business Solutions"), child->GetTitle()); ASSERT_TRUE(child->GetURL() == GURL("http://www.google.com/services/")); parent = bb_model_->other_node(); @@ -849,12 +847,12 @@ class BookmarkModelTestWithProfile2 : public BookmarkModelTestWithProfile { child = parent->GetChild(0); ASSERT_TRUE(child->is_folder()); - ASSERT_EQ(ASCIIToUTF16("OF1"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("OF1"), child->GetTitle()); ASSERT_EQ(0, child->GetChildCount()); child = parent->GetChild(1); ASSERT_EQ(BookmarkNode::URL, child->type()); - ASSERT_EQ(ASCIIToUTF16("About Google"), child->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("About Google"), child->GetTitle()); ASSERT_TRUE(child->GetURL() == GURL("http://www.google.com/intl/en/about.html")); @@ -987,8 +985,8 @@ TEST_F(BookmarkModelTest, Sort) { // Make sure the order matches (remember, 'a' and 'C' are folders and // come first). - EXPECT_EQ(parent->GetChild(0)->GetTitleAsString16(), ASCIIToUTF16("a")); - EXPECT_EQ(parent->GetChild(1)->GetTitleAsString16(), ASCIIToUTF16("C")); - EXPECT_EQ(parent->GetChild(2)->GetTitleAsString16(), ASCIIToUTF16("B")); - EXPECT_EQ(parent->GetChild(3)->GetTitleAsString16(), ASCIIToUTF16("d")); + EXPECT_EQ(parent->GetChild(0)->GetTitle(), ASCIIToUTF16("a")); + EXPECT_EQ(parent->GetChild(1)->GetTitle(), ASCIIToUTF16("C")); + EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B")); + EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d")); } diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 47ef996..95767211 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -12,6 +12,7 @@ #include "base/string_number_conversions.h" #include "base/string16.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/bookmarks/bookmark_model.h" #if defined(OS_MACOSX) @@ -193,7 +194,7 @@ bool DoesBookmarkContainWords(const BookmarkNode* node, const std::string& languages) { return DoesBookmarkTextContainWords( - l10n_util::ToLower(node->GetTitleAsString16()), words) || + l10n_util::ToLower(node->GetTitle()), words) || DoesBookmarkTextContainWords( l10n_util::ToLower(UTF8ToUTF16(node->GetURL().spec())), words) || DoesBookmarkTextContainWords(l10n_util::ToLower( diff --git a/chrome/browser/bookmarks/recently_used_folders_combo_model.cc b/chrome/browser/bookmarks/recently_used_folders_combo_model.cc index 529a6ae..e6309f4 100644 --- a/chrome/browser/bookmarks/recently_used_folders_combo_model.cc +++ b/chrome/browser/bookmarks/recently_used_folders_combo_model.cc @@ -56,7 +56,7 @@ int RecentlyUsedFoldersComboModel::GetItemCount() { string16 RecentlyUsedFoldersComboModel::GetItemAt(int index) { if (index == static_cast<int>(nodes_.size())) return l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_CHOOSER_ANOTHER_FOLDER); - return nodes_[index]->GetTitleAsString16(); + return nodes_[index]->GetTitle(); } const BookmarkNode* RecentlyUsedFoldersComboModel::GetNodeAt(int index) { diff --git a/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm b/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm index a1aa22c..af30c04 100644 --- a/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm +++ b/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm @@ -83,7 +83,7 @@ if (!bookmarkNode_) return tempTitle_; - return base::SysUTF16ToNSString(bookmarkNode_->GetTitleAsString16()); + return base::SysUTF16ToNSString(bookmarkNode_->GetTitle()); } - (void)setTitle:(NSString*)aTitle { diff --git a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm index 823bccc..7f9878d 100644 --- a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm @@ -77,6 +77,6 @@ TEST_F(BookmarkAllTabsControllerTest, BookmarkAllTabs) { [controller_ ok:nil]; EXPECT_EQ(4, group_a_->GetChildCount()); const BookmarkNode* folderChild = group_a_->GetChild(3); - EXPECT_EQ(folderChild->GetTitleAsString16(), ASCIIToUTF16("ALL MY TABS")); + EXPECT_EQ(folderChild->GetTitle(), ASCIIToUTF16("ALL MY TABS")); EXPECT_EQ(3, folderChild->GetChildCount()); } diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index 401760c..7bd2988 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -984,7 +984,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; // Add a tooltip std::string url_string = child->GetURL().possibly_invalid_spec(); NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", - base::SysUTF16ToNSString(child->GetTitleAsString16()), + base::SysUTF16ToNSString(child->GetTitle()), url_string.c_str()]; [item setToolTip:tooltip]; } @@ -1013,7 +1013,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node { if (!node->is_folder()) return nil; - NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(node->GetTitle()); NSMenu* menu = [[[NSMenu alloc] initWithTitle:title] autorelease]; [self addFolderNode:node toMenu:menu]; @@ -1105,7 +1105,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; [button setTarget:self]; [button setAction:@selector(openBookmark:)]; // Add a tooltip. - NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(node->GetTitle()); std::string url_string = node->GetURL().possibly_invalid_spec(); NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", title, url_string.c_str()]; diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 13a110c..7c29c00 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -1044,8 +1044,7 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) { std::string my_string = parent->GetChild(i)->GetURL().spec(); EXPECT_NE(gurl_string.find(my_string), std::string::npos); } - EXPECT_EQ(parent->GetChild(i)->GetTitleAsString16(), - ASCIIToUTF16(titles[i])); + EXPECT_EQ(parent->GetChild(i)->GetTitle(), ASCIIToUTF16(titles[i])); } } @@ -1167,8 +1166,7 @@ TEST_F(BookmarkBarControllerTest, TestDragButton) { EXPECT_EQ(1, folder->GetChildCount()); x = NSMidX([[[bar_ buttons] objectAtIndex:0] frame]); x += [[bar_ view] frame].origin.x; - string16 title = - [[[bar_ buttons] objectAtIndex:2] bookmarkNode]->GetTitleAsString16(); + string16 title = [[[bar_ buttons] objectAtIndex:2] bookmarkNode]->GetTitle(); [bar_ dragButton:[[bar_ buttons] objectAtIndex:2] to:NSMakePoint(x, 0) copy:NO]; @@ -1177,7 +1175,7 @@ TEST_F(BookmarkBarControllerTest, TestDragButton) { // In the folder EXPECT_EQ(2, folder->GetChildCount()); // At the end - EXPECT_EQ(title, folder->GetChild(1)->GetTitleAsString16()); + EXPECT_EQ(title, folder->GetChild(1)->GetTitle()); } TEST_F(BookmarkBarControllerTest, TestCopyButton) { @@ -1948,7 +1946,7 @@ TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkData) { ASSERT_TRUE(targetButton); NSPoint targetPoint = [targetButton center]; newNode = other->GetChild(2); // Should be O4f. - EXPECT_EQ(newNode->GetTitleAsString16(), ASCIIToUTF16("O4f")); + EXPECT_EQ(newNode->GetTitle(), ASCIIToUTF16("O4f")); [bar_ setDragDataNode:newNode]; [dragInfo setDropLocation:targetPoint]; [bar_ dragBookmarkData:(id<NSDraggingInfo>)dragInfo.get()]; diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm index 26e498a..c915bc9 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm @@ -261,7 +261,7 @@ const CGFloat kScrollWindowVerticalMargin = 0.0; [button setTarget:self]; [button setAction:@selector(openBookmark:)]; // Add a tooltip. - NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(node->GetTitle()); std::string urlString = node->GetURL().possibly_invalid_spec(); NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", title, urlString.c_str()]; diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm index b84cc58..3d46a62 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm @@ -1311,7 +1311,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkData) { targetButton = [folderController buttonWithTitleEqualTo:@"2f2f"]; ASSERT_TRUE(targetButton); newNode = other->GetChild(2); // Should be O4f. - EXPECT_EQ(newNode->GetTitleAsString16(), ASCIIToUTF16("O4f")); + EXPECT_EQ(newNode->GetTitle(), ASCIIToUTF16("O4f")); [folderController setDragDataNode:newNode]; [dragInfo setDropLocation:[targetButton center]]; [folderController dragBookmarkData:(id<NSDraggingInfo>)dragInfo.get()]; diff --git a/chrome/browser/cocoa/bookmark_bubble_controller.mm b/chrome/browser/cocoa/bookmark_bubble_controller.mm index 4b8d154..0258d0d 100644 --- a/chrome/browser/cocoa/bookmark_bubble_controller.mm +++ b/chrome/browser/cocoa/bookmark_bubble_controller.mm @@ -278,7 +278,7 @@ void BookmarkBubbleNotificationBridge::Observe( - (IBAction)remove:(id)sender { [self stopPulsingBookmarkButton]; // TODO(viettrungluu): get rid of conversion and utf_string_conversions.h. - model_->SetURLStarred(node_->GetURL(), node_->GetTitleAsString16(), false); + model_->SetURLStarred(node_->GetURL(), node_->GetTitle(), false); UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Unstar"), model_->profile()); node_ = NULL; // no longer valid @@ -323,7 +323,7 @@ void BookmarkBubbleNotificationBridge::Observe( if (!node_) return; // First the title... - NSString* oldTitle = base::SysUTF16ToNSString(node_->GetTitleAsString16()); + NSString* oldTitle = base::SysUTF16ToNSString(node_->GetTitle()); NSString* newTitle = [nameTextField_ stringValue]; if (![oldTitle isEqual:newTitle]) { model_->SetTitle(node_, base::SysNSStringToUTF16(newTitle)); @@ -352,8 +352,7 @@ void BookmarkBubbleNotificationBridge::Observe( // Fill in all information related to the folder pop up button. - (void)fillInFolderList { - [nameTextField_ - setStringValue:base::SysUTF16ToNSString(node_->GetTitleAsString16())]; + [nameTextField_ setStringValue:base::SysUTF16ToNSString(node_->GetTitle())]; DCHECK([folderPopUpButton_ numberOfItems] == 0); [self addFolderNodes:model_->root_node() toPopUpButton:folderPopUpButton_ @@ -387,7 +386,7 @@ void BookmarkBubbleNotificationBridge::Observe( toPopUpButton:(NSPopUpButton*)button indentation:(int)indentation { if (!model_->is_root(parent)) { - NSString* title = base::SysUTF16ToNSString(parent->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(parent->GetTitle()); NSMenu* menu = [button menu]; NSMenuItem* item = [menu addItemWithTitle:title action:NULL diff --git a/chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm index 7dd01d9..2c445f3 100644 --- a/chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm @@ -276,8 +276,8 @@ TEST_F(BookmarkBubbleControllerTest, TestUserEdit) { [controller edit:controller]; // Make sure bookmark has changed - EXPECT_EQ(node->GetTitleAsString16(), ASCIIToUTF16("oops")); - EXPECT_EQ(node->GetParent()->GetTitleAsString16(), ASCIIToUTF16("grandma")); + EXPECT_EQ(node->GetTitle(), ASCIIToUTF16("oops")); + EXPECT_EQ(node->GetParent()->GetTitle(), ASCIIToUTF16("grandma")); } // Confirm happiness with parent nodes that have the same name. diff --git a/chrome/browser/cocoa/bookmark_button_cell.mm b/chrome/browser/cocoa/bookmark_button_cell.mm index cc03904..368f34f 100644 --- a/chrome/browser/cocoa/bookmark_button_cell.mm +++ b/chrome/browser/cocoa/bookmark_button_cell.mm @@ -48,7 +48,7 @@ [self setBookmarkNode:node]; if (node) { - NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(node->GetTitle()); [self setBookmarkCellText:title image:cellImage]; [self setMenu:contextMenu]; } else { diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller.mm b/chrome/browser/cocoa/bookmark_editor_base_controller.mm index 044233e..03a7942 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller.mm +++ b/chrome/browser/cocoa/bookmark_editor_base_controller.mm @@ -395,8 +395,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { for (int i = 0; i < childCount; ++i) { const BookmarkNode* childNode = node->GetChild(i); if (childNode->type() != BookmarkNode::URL) { - NSString* childName = - base::SysUTF16ToNSString(childNode->GetTitleAsString16()); + NSString* childName = base::SysUTF16ToNSString(childNode->GetTitle()); NSMutableArray* children = [self addChildFoldersFromNode:childNode]; BookmarkFolderInfo* folderInfo = [BookmarkFolderInfo bookmarkFolderInfoWithFolderName:childName diff --git a/chrome/browser/cocoa/bookmark_editor_controller.mm b/chrome/browser/cocoa/bookmark_editor_controller.mm index 5461640..90b47ed 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller.mm +++ b/chrome/browser/cocoa/bookmark_editor_controller.mm @@ -48,7 +48,7 @@ // Set text fields to match our bookmark. If the node is NULL we // arrived here from an "Add Page..." item in a context menu. if (node_) { - [self setInitialName:base::SysUTF16ToNSString(node_->GetTitleAsString16())]; + [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; std::string url_string = node_->GetURL().possibly_invalid_spec(); initialUrl_.reset([[NSString stringWithUTF8String:url_string.c_str()] retain]); diff --git a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm index 385adae..8c826ac 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm @@ -52,7 +52,7 @@ TEST_F(BookmarkEditorControllerTest, NoEdit) { [controller_ cancel:nil]; ASSERT_EQ(default_parent_->GetChildCount(), 1); const BookmarkNode* child = default_parent_->GetChild(0); - EXPECT_EQ(child->GetTitleAsString16(), default_title_); + EXPECT_EQ(child->GetTitle(), default_title_); EXPECT_EQ(child->GetURL(), GURL(default_name_)); } @@ -61,7 +61,7 @@ TEST_F(BookmarkEditorControllerTest, EditTitle) { [controller_ ok:nil]; ASSERT_EQ(default_parent_->GetChildCount(), 1); const BookmarkNode* child = default_parent_->GetChild(0); - EXPECT_EQ(child->GetTitleAsString16(), ASCIIToUTF16("whamma jamma bamma")); + EXPECT_EQ(child->GetTitle(), ASCIIToUTF16("whamma jamma bamma")); EXPECT_EQ(child->GetURL(), GURL(default_name_)); } @@ -72,7 +72,7 @@ TEST_F(BookmarkEditorControllerTest, EditURL) { [controller_ ok:nil]; ASSERT_EQ(default_parent_->GetChildCount(), 1); const BookmarkNode* child = default_parent_->GetChild(0); - EXPECT_EQ(child->GetTitleAsString16(), default_title_); + EXPECT_EQ(child->GetTitle(), default_title_); EXPECT_EQ(child->GetURL(), GURL("http://yellow-sneakers.com/")); } @@ -388,7 +388,7 @@ TEST_F(BookmarkEditorControllerTreeTest, ChangeNameAndBookmarkGroup) { ASSERT_EQ(parent, group_c_); int childIndex = parent->IndexOfChild(bookmark_bb_3_); ASSERT_EQ(4, childIndex); - EXPECT_EQ(bookmark_bb_3_->GetTitleAsString16(), ASCIIToUTF16("NEW NAME")); + EXPECT_EQ(bookmark_bb_3_->GetTitle(), ASCIIToUTF16("NEW NAME")); } TEST_F(BookmarkEditorControllerTreeTest, AddFolderWithGroupSelected) { @@ -418,6 +418,6 @@ TEST_F(BookmarkEditorControllerTreeNoNodeTest, NewBookmarkNoNode) { [controller_ ok:nil]; const BookmarkNode* new_node = group_bb_->GetChild(5); ASSERT_EQ(0, new_node->GetChildCount()); - EXPECT_EQ(new_node->GetTitleAsString16(), ASCIIToUTF16("NEW BOOKMARK")); + EXPECT_EQ(new_node->GetTitle(), ASCIIToUTF16("NEW BOOKMARK")); EXPECT_EQ(new_node->GetURL(), GURL("http://NEWURL.com")); } diff --git a/chrome/browser/cocoa/bookmark_folder_target.mm b/chrome/browser/cocoa/bookmark_folder_target.mm index 7e957d2..2380b49 100644 --- a/chrome/browser/cocoa/bookmark_folder_target.mm +++ b/chrome/browser/cocoa/bookmark_folder_target.mm @@ -79,7 +79,7 @@ NSString* kBookmarkButtonDragType = @"ChromiumBookmarkButtonDragType"; } else { const std::string spec = node->GetURL().spec(); NSString* url = base::SysUTF8ToNSString(spec); - NSString* title = base::SysUTF16ToNSString(node->GetTitleAsString16()); + NSString* title = base::SysUTF16ToNSString(node->GetTitle()); [pboard declareURLPasteboardWithAdditionalTypes:[NSArray array] owner:nil]; [pboard setDataForURL:url title:title]; diff --git a/chrome/browser/cocoa/bookmark_menu_bridge.mm b/chrome/browser/cocoa/bookmark_menu_bridge.mm index cc11a47..493e5e8 100644 --- a/chrome/browser/cocoa/bookmark_menu_bridge.mm +++ b/chrome/browser/cocoa/bookmark_menu_bridge.mm @@ -222,7 +222,7 @@ void BookmarkMenuBridge::ConfigureMenuItem(const BookmarkNode* node, // Add a tooltip std::string url_string = node->GetURL().possibly_invalid_spec(); NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", - base::SysUTF16ToNSString(node->GetTitleAsString16()), + base::SysUTF16ToNSString(node->GetTitle()), url_string.c_str()]; [item setToolTip:tooltip]; diff --git a/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm b/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm index 0acbc4b..6eae73c 100644 --- a/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm @@ -31,8 +31,7 @@ const NSUInteger kMaximumMenuPixelsWide = 300; NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" gfx::Font font(base::SysNSStringToWide([nsfont fontName]), static_cast<int>([nsfont pointSize])); - std::wstring title = gfx::ElideText(UTF16ToWideHack( - node->GetTitleAsString16()), + std::wstring title = gfx::ElideText(UTF16ToWideHack(node->GetTitle()), font, kMaximumMenuPixelsWide, false); diff --git a/chrome/browser/cocoa/bookmark_name_folder_controller.mm b/chrome/browser/cocoa/bookmark_name_folder_controller.mm index c2c0f54..a854b8f 100644 --- a/chrome/browser/cocoa/bookmark_name_folder_controller.mm +++ b/chrome/browser/cocoa/bookmark_name_folder_controller.mm @@ -32,8 +32,7 @@ DCHECK_LE(newIndex, parent->GetChildCount()); } if (node_) { - initialName_.reset( - [base::SysUTF16ToNSString(node_->GetTitleAsString16()) retain]); + initialName_.reset([base::SysUTF16ToNSString(node_->GetTitle()) retain]); } else { NSString* newString = l10n_util::GetNSStringWithFixup(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME); diff --git a/chrome/browser/cocoa/bookmark_name_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_name_folder_controller_unittest.mm index 9419b8f..f78cf22 100644 --- a/chrome/browser/cocoa/bookmark_name_folder_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_name_folder_controller_unittest.mm @@ -46,7 +46,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNew) { [controller ok:nil]; EXPECT_EQ(1, parent->GetChildCount()); EXPECT_TRUE(parent->GetChild(0)->is_folder()); - EXPECT_EQ(ASCIIToUTF16("Bozo"), parent->GetChild(0)->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("Bozo"), parent->GetChild(0)->GetTitle()); } // Add new but specify a sibling. @@ -76,7 +76,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewWithSibling) { // Confirm we now have 3, and that the new one is in the middle. EXPECT_EQ(3, parent->GetChildCount()); EXPECT_TRUE(parent->GetChild(1)->is_folder()); - EXPECT_EQ(ASCIIToUTF16("middle"), parent->GetChild(1)->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("middle"), parent->GetChild(1)->GetTitle()); } // Make sure we are allowed to create a folder named "New Folder". @@ -142,7 +142,7 @@ TEST_F(BookmarkNameFolderControllerTest, Rename) { [controller ok:nil]; EXPECT_EQ(1, parent->GetChildCount()); EXPECT_TRUE(parent->GetChild(0)->is_folder()); - EXPECT_EQ(ASCIIToUTF16("Zobo"), parent->GetChild(0)->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("Zobo"), parent->GetChild(0)->GetTitle()); } TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) { diff --git a/chrome/browser/cocoa/collected_cookies_mac.mm b/chrome/browser/cocoa/collected_cookies_mac.mm index e01c62d..671bf87 100644 --- a/chrome/browser/cocoa/collected_cookies_mac.mm +++ b/chrome/browser/cocoa/collected_cookies_mac.mm @@ -230,7 +230,7 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { setting); if (!lastDomain.empty()) multipleDomainsChanged = YES; - lastDomain = origin_node->GetTitleAsString16(); + lastDomain = origin_node->GetTitle(); } if (multipleDomainsChanged) [self showInfoBarForMultipleDomainsAndSetting:setting]; diff --git a/chrome/browser/cocoa/cookie_tree_node.mm b/chrome/browser/cocoa/cookie_tree_node.mm index 114f739..4b0dd6f 100644 --- a/chrome/browser/cocoa/cookie_tree_node.mm +++ b/chrome/browser/cocoa/cookie_tree_node.mm @@ -18,8 +18,7 @@ } - (void)rebuild { - title_.reset( - [base::SysUTF16ToNSString(treeNode_->GetTitleAsString16()) retain]); + title_.reset([base::SysUTF16ToNSString(treeNode_->GetTitle()) retain]); children_.reset(); // The tree node assumes ownership of the cookie details object details_.reset([[CocoaCookieDetails createFromCookieTreeNode:(treeNode_)] diff --git a/chrome/browser/cocoa/extension_installed_bubble_controller.mm b/chrome/browser/cocoa/extension_installed_bubble_controller.mm index 511fba4..4a22436 100644 --- a/chrome/browser/cocoa/extension_installed_bubble_controller.mm +++ b/chrome/browser/cocoa/extension_installed_bubble_controller.mm @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "base/mac_util.h" #include "base/sys_string_conversions.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/cocoa/browser_window_cocoa.h" diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc index 1316341..afb395d 100644 --- a/chrome/browser/cookies_tree_model.cc +++ b/chrome/browser/cookies_tree_model.cc @@ -72,8 +72,8 @@ class OriginNodeComparator { // google.com, ad.google.com, www.google.com, // microsoft.com, ad.microsoft.com. CanonicalizeHost transforms the origins // into a form like google.com.www so that string comparisons work. - return (CanonicalizeHost(lhs->GetTitleAsString16()) < - CanonicalizeHost(rhs->GetTitleAsString16())); + return (CanonicalizeHost(lhs->GetTitle()) < + CanonicalizeHost(rhs->GetTitle())); } private: @@ -196,7 +196,7 @@ CookieTreeOriginNode* CookieTreeRootNode::GetOrCreateOriginNode( OriginNodeComparator()); if (origin_node_iterator != children().end() && - CookieTreeOriginNode::TitleForUrl(url) == + WideToUTF16Hack(CookieTreeOriginNode::TitleForUrl(url)) == (*origin_node_iterator)->GetTitle()) return static_cast<CookieTreeOriginNode*>(*origin_node_iterator); // Node doesn't exist, create a new one and insert it into the (ordered) @@ -327,7 +327,7 @@ bool CookieTreeNode::NodeTitleComparator::operator() ( static_cast<const CookieTreeNode*>(lhs); const CookieTreeNode* right = static_cast<const CookieTreeNode*>(rhs); - return (left->GetTitleAsString16() < right->GetTitleAsString16()); + return (left->GetTitle() < right->GetTitle()); } void CookieTreeNode::AddChildSortedByTitle(CookieTreeNode* new_child) { diff --git a/chrome/browser/cookies_tree_model.h b/chrome/browser/cookies_tree_model.h index 9f7c4ca..dc040dd 100644 --- a/chrome/browser/cookies_tree_model.h +++ b/chrome/browser/cookies_tree_model.h @@ -180,7 +180,7 @@ class CookieTreeOriginNode : public CookieTreeNode { // CookieTreeNode methods: virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetTitleAsString16(), + return DetailedInfo(GetTitle(), DetailedInfo::TYPE_ORIGIN, NULL, NULL, NULL, NULL, NULL); } @@ -231,7 +231,7 @@ class CookieTreeCookieNode : public CookieTreeNode { // CookieTreeNode methods: virtual void DeleteStoredObjects(); virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetParent()->GetTitle(), DetailedInfo::TYPE_COOKIE, cookie_, NULL, NULL, NULL, NULL); } @@ -250,7 +250,7 @@ class CookieTreeCookiesNode : public CookieTreeNode { virtual ~CookieTreeCookiesNode() {} virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetTitle(), DetailedInfo::TYPE_COOKIES, NULL, NULL, NULL, NULL, NULL); } @@ -276,7 +276,7 @@ class CookieTreeAppCacheNode : public CookieTreeNode { virtual void DeleteStoredObjects(); virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetParent()->GetTitle(), DetailedInfo::TYPE_APPCACHE, NULL, NULL, NULL, NULL, appcache_info_); } @@ -292,7 +292,7 @@ class CookieTreeAppCachesNode : public CookieTreeNode { virtual ~CookieTreeAppCachesNode() {} virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetTitle(), DetailedInfo::TYPE_APPCACHES, NULL, NULL, NULL, NULL, NULL); } @@ -318,7 +318,7 @@ class CookieTreeDatabaseNode : public CookieTreeNode { virtual void DeleteStoredObjects(); virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetParent()->GetTitle(), DetailedInfo::TYPE_DATABASE, NULL, database_info_, NULL, NULL, NULL); } @@ -337,7 +337,7 @@ class CookieTreeDatabasesNode : public CookieTreeNode { virtual ~CookieTreeDatabasesNode() {} virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetTitle(), DetailedInfo::TYPE_DATABASES, NULL, NULL, NULL, NULL, NULL); } @@ -364,7 +364,7 @@ class CookieTreeLocalStorageNode : public CookieTreeNode { // CookieTreeNode methods: virtual void DeleteStoredObjects(); virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetParent()->GetTitle(), DetailedInfo::TYPE_LOCAL_STORAGE, NULL, NULL, local_storage_info_, NULL, NULL); } @@ -383,7 +383,7 @@ class CookieTreeLocalStoragesNode : public CookieTreeNode { virtual ~CookieTreeLocalStoragesNode() {} virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetTitle(), DetailedInfo::TYPE_LOCAL_STORAGES, NULL, NULL, NULL, NULL, NULL); } @@ -410,7 +410,7 @@ class CookieTreeSessionStorageNode : public CookieTreeNode { // CookieTreeNode methods: virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetParent()->GetTitle(), DetailedInfo::TYPE_SESSION_STORAGE, NULL, NULL, NULL, session_storage_info_, NULL); } @@ -429,7 +429,7 @@ class CookieTreeSessionStoragesNode : public CookieTreeNode { virtual ~CookieTreeSessionStoragesNode() {} virtual DetailedInfo GetDetailedInfo() const { - return DetailedInfo(GetParent()->GetTitleAsString16(), + return DetailedInfo(GetParent()->GetTitle(), DetailedInfo::TYPE_SESSION_STORAGES, NULL, NULL, NULL, NULL, NULL); } diff --git a/chrome/browser/dom_ui/bug_report_ui.cc b/chrome/browser/dom_ui/bug_report_ui.cc index b86f64c..d3b888b 100644 --- a/chrome/browser/dom_ui/bug_report_ui.cc +++ b/chrome/browser/dom_ui/bug_report_ui.cc @@ -17,6 +17,7 @@ #include "base/string_number_conversions.h" #include "base/thread.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "base/weak_ptr.h" #include "chrome/browser/bookmarks/bookmark_model.h" diff --git a/chrome/browser/dom_ui/cookies_view_handler.cc b/chrome/browser/dom_ui/cookies_view_handler.cc index 0453ced..0357d63 100644 --- a/chrome/browser/dom_ui/cookies_view_handler.cc +++ b/chrome/browser/dom_ui/cookies_view_handler.cc @@ -59,7 +59,7 @@ bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, DictionaryValue* dict) { // Use node's address as an id for DOMUI to look it up. dict->SetString(kKeyId, PointerToHexString(&node)); - dict->SetString(kKeyTitle, node.GetTitleAsString16()); + dict->SetString(kKeyTitle, node.GetTitle()); switch (node.GetDetailedInfo().node_type) { case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: { diff --git a/chrome/browser/extensions/extension_bookmark_helpers.cc b/chrome/browser/extensions/extension_bookmark_helpers.cc index 25c24a0..ad7cbb0 100644 --- a/chrome/browser/extensions/extension_bookmark_helpers.cc +++ b/chrome/browser/extensions/extension_bookmark_helpers.cc @@ -36,7 +36,7 @@ DictionaryValue* GetNodeDictionary(const BookmarkNode* node, dict->SetReal(keys::kDateGroupModifiedKey, floor(t.ToDoubleT() * 1000)); } - dict->SetString(keys::kTitleKey, node->GetTitleAsString16()); + dict->SetString(keys::kTitleKey, node->GetTitle()); if (!node->date_added().is_null()) { // Javascript Date wants milliseconds since the epoch, ToDoubleT is // seconds. diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc index 3fd8a18..8e6df4d 100644 --- a/chrome/browser/extensions/extension_bookmark_manager_api.cc +++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc @@ -86,7 +86,7 @@ void AddNodeToList(ListValue* list, const BookmarkNode& node) { if (node.is_url()) dict->SetString(keys::kUrlKey, node.GetURL().spec()); - dict->SetString(keys::kTitleKey, node.GetTitleAsString16()); + dict->SetString(keys::kTitleKey, node.GetTitle()); ListValue* children = new ListValue(); for (int i = 0; i < node.GetChildCount(); ++i) diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index 1b3a986..3f3e8c9 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -173,7 +173,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeChanged( // for now we only include title and url. The ideal thing would be to change // BookmarkModel to indicate what changed. DictionaryValue* object_args = new DictionaryValue(); - object_args->SetString(keys::kTitleKey, node->GetTitleAsString16()); + object_args->SetString(keys::kTitleKey, node->GetTitle()); if (node->is_url()) object_args->SetString(keys::kUrlKey, node->GetURL().spec()); args.Append(object_args); @@ -628,7 +628,7 @@ class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { if (!parent) return; - std::string bucket_id = UTF16ToUTF8(parent->GetTitleAsString16()); + std::string bucket_id = UTF16ToUTF8(parent->GetTitle()); std::string title; json->GetString(keys::kTitleKey, &title); std::string url_string; @@ -664,8 +664,8 @@ class RemoveBookmarksBucketMapper : public BookmarkBucketMapper<std::string> { return; std::string bucket_id; - bucket_id += UTF16ToUTF8(node->GetParent()->GetTitleAsString16()); - bucket_id += UTF16ToUTF8(node->GetTitleAsString16()); + bucket_id += UTF16ToUTF8(node->GetParent()->GetTitle()); + bucket_id += UTF16ToUTF8(node->GetTitle()); bucket_id += node->GetURL().spec(); buckets->push_back(GetBucket(base::SHA1HashString(bucket_id))); } diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 8e86ee4..ee27bcf 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -9,6 +9,7 @@ #include "app/gtk_dnd_util.h" #include "app/resource_bundle.h" #include "base/pickle.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.cc b/chrome/browser/gtk/bookmark_bubble_gtk.cc index eeb7833..6c57dc0 100644 --- a/chrome/browser/gtk/bookmark_bubble_gtk.cc +++ b/chrome/browser/gtk/bookmark_bubble_gtk.cc @@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/string16.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -275,7 +276,7 @@ void BookmarkBubbleGtk::ApplyEdits() { const string16 new_title( UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(name_entry_)))); - if (new_title != node->GetTitleAsString16()) { + if (new_title != node->GetTitle()) { model->SetTitle(node, new_title); UserMetrics::RecordAction( UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"), @@ -305,7 +306,7 @@ std::string BookmarkBubbleGtk::GetTitle() { return std::string(); } - return UTF16ToUTF8(node->GetTitleAsString16()); + return UTF16ToUTF8(node->GetTitle()); } void BookmarkBubbleGtk::ShowEditor() { diff --git a/chrome/browser/gtk/bookmark_editor_gtk.cc b/chrome/browser/gtk/bookmark_editor_gtk.cc index 8016644..5aafc6c 100644 --- a/chrome/browser/gtk/bookmark_editor_gtk.cc +++ b/chrome/browser/gtk/bookmark_editor_gtk.cc @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/gtk/bookmark_tree_model.h" @@ -131,10 +132,9 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) { name_entry_ = gtk_entry_new(); std::string title; if (details_.type == EditDetails::EXISTING_NODE) { - title = WideToUTF8(details_.existing_node->GetTitle()); + title = UTF16ToUTF8(details_.existing_node->GetTitle()); } else if (details_.type == EditDetails::NEW_FOLDER) { - title = WideToUTF8( - l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME)); + title = l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME); } gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str()); g_signal_connect(name_entry_, "changed", diff --git a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc b/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc index 37a696b..291f66f 100644 --- a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc +++ b/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc @@ -148,7 +148,7 @@ TEST_F(BookmarkEditorGtkTest, EditTitleKeepsPosition) { const BookmarkNode* bb_node = profile_->GetBookmarkModel()->GetBookmarkBarNode(); - ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitle()); // The URL shouldn't have changed. ASSERT_TRUE(GURL(base_path() + "a") == bb_node->GetChild(0)->GetURL()); } @@ -169,7 +169,7 @@ TEST_F(BookmarkEditorGtkTest, EditURLKeepsPosition) { const BookmarkNode* bb_node = profile_->GetBookmarkModel()->GetBookmarkBarNode(); - ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitle()); // The URL should have changed. ASSERT_TRUE(GURL(base_path() + "new_a") == bb_node->GetChild(0)->GetURL()); ASSERT_TRUE(node_time == bb_node->GetChild(0)->date_added()); @@ -188,7 +188,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeParent) { editor.ApplyEdits(>k_other_node); const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); - ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); ASSERT_TRUE(GURL(base_path() + "a") == other_node->GetChild(2)->GetURL()); } @@ -210,7 +210,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeParentAndURL) { editor.ApplyEdits(>k_other_node); const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); - ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); ASSERT_TRUE(GURL(base_path() + "new_a") == other_node->GetChild(2)->GetURL()); ASSERT_TRUE(node_time == other_node->GetChild(2)->date_added()); } @@ -253,14 +253,14 @@ TEST_F(BookmarkEditorGtkTest, MoveToNewParent) { // F2 in the model should have two children now: F21 and the node edited. ASSERT_EQ(2, mf2->GetChildCount()); // F21 should be first. - ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitle()); // Then a. - ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitle()); // F21 should have one child, F211. const BookmarkNode* mf21 = mf2->GetChild(0); ASSERT_EQ(1, mf21->GetChildCount()); - ASSERT_EQ(ASCIIToUTF16("F211"), mf21->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F211"), mf21->GetChild(0)->GetTitle()); } // Brings up the editor, creating a new URL on the bookmark bar. @@ -283,7 +283,7 @@ TEST_F(BookmarkEditorGtkTest, NewURL) { ASSERT_EQ(4, bb_node->GetChildCount()); const BookmarkNode* new_node = bb_node->GetChild(3); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); } @@ -305,7 +305,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeURLNoTree) { const BookmarkNode* new_node = other_node->GetChild(0); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); } @@ -323,5 +323,5 @@ TEST_F(BookmarkEditorGtkTest, ChangeTitleNoTree) { ASSERT_EQ(2, other_node->GetChildCount()); const BookmarkNode* new_node = other_node->GetChild(0); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); } diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc index dd5abe2..f966719 100644 --- a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc @@ -9,6 +9,7 @@ #include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/gtk/bookmark_utils_gtk.h" @@ -147,7 +148,7 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, // This breaks on word boundaries. Ideally we would break on character // boundaries. std::string elided_name = WideToUTF8( - l10n_util::TruncateString(UTF16ToWideHack(node->GetTitleAsString16()), + l10n_util::TruncateString(UTF16ToWideHack(node->GetTitle()), kMaxChars)); GtkWidget* menu_item = gtk_image_menu_item_new_with_label(elided_name.c_str()); diff --git a/chrome/browser/gtk/bookmark_tree_model.cc b/chrome/browser/gtk/bookmark_tree_model.cc index 041b0b6..d6ef4de 100644 --- a/chrome/browser/gtk/bookmark_tree_model.cc +++ b/chrome/browser/gtk/bookmark_tree_model.cc @@ -7,6 +7,7 @@ #include <gtk/gtk.h> #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/gtk/bookmark_utils_gtk.h" #include "chrome/browser/gtk/gtk_theme_provider.h" @@ -26,7 +27,7 @@ void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, gtk_tree_store_set(store, iter, bookmark_utils::FOLDER_ICON, GtkThemeProvider::GetFolderIcon(true), bookmark_utils::FOLDER_NAME, - UTF16ToUTF8(node->GetTitleAsString16()).c_str(), + UTF16ToUTF8(node->GetTitle()).c_str(), bookmark_utils::ITEM_ID, node->id(), // We don't want to use node->is_folder() because that would let the // user edit "Bookmarks Bar" and "Other Bookmarks". diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/gtk/bookmark_utils_gtk.cc index 3cb4bc4e8..b6d1856 100644 --- a/chrome/browser/gtk/bookmark_utils_gtk.cc +++ b/chrome/browser/gtk/bookmark_utils_gtk.cc @@ -10,6 +10,7 @@ #include "base/pickle.h" #include "base/string16.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -223,8 +224,7 @@ GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, BookmarkModel* model, GtkThemeProvider* provider) { GdkPixbuf* pixbuf = GetPixbufForNode(node, model, provider->UseGtkTheme()); - GtkWidget* widget = GetDragRepresentation(pixbuf, - node->GetTitleAsString16(), provider); + GtkWidget* widget = GetDragRepresentation(pixbuf, node->GetTitle(), provider); g_object_unref(pixbuf); return widget; } @@ -233,8 +233,8 @@ void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, GtkWidget* button, GtkThemeProvider* provider) { GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model, provider->UseGtkTheme()); - PackButton(pixbuf, node->GetTitleAsString16(), node != model->other_node(), - provider, button); + PackButton(pixbuf, node->GetTitle(), node != model->other_node(), provider, + button); g_object_unref(pixbuf); std::string tooltip = BuildTooltipFor(node); @@ -247,7 +247,7 @@ void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, std::string BuildTooltipFor(const BookmarkNode* node) { const std::string& url = node->GetURL().possibly_invalid_spec(); - const std::string& title = UTF16ToUTF8(node->GetTitleAsString16()); + const std::string& title = UTF16ToUTF8(node->GetTitle()); std::string truncated_url = WideToUTF8(l10n_util::TruncateString( UTF8ToWide(url), kMaxTooltipURLLength)); @@ -261,7 +261,7 @@ std::string BuildTooltipFor(const BookmarkNode* node) { return escaped_url; } else { std::string truncated_title = WideToUTF8(l10n_util::TruncateString( - UTF16ToWideHack(node->GetTitleAsString16()), kMaxTooltipTitleLength)); + UTF16ToWideHack(node->GetTitle()), kMaxTooltipTitleLength)); gchar* escaped_title_cstr = g_markup_escape_text(truncated_title.c_str(), truncated_title.size()); std::string escaped_title(escaped_title_cstr); @@ -329,8 +329,8 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, } case gtk_dnd_util::NETSCAPE_URL: { // _NETSCAPE_URL format is URL + \n + title. - std::string utf8_text = nodes[0]->GetURL().spec() + "\n" + UTF16ToUTF8( - nodes[0]->GetTitleAsString16()); + std::string utf8_text = nodes[0]->GetURL().spec() + "\n" + + UTF16ToUTF8(nodes[0]->GetTitle()); gtk_selection_data_set(selection_data, selection_data->target, kBitsInAByte, diff --git a/chrome/browser/gtk/collected_cookies_gtk.cc b/chrome/browser/gtk/collected_cookies_gtk.cc index 8d4dbf7..324593a 100644 --- a/chrome/browser/gtk/collected_cookies_gtk.cc +++ b/chrome/browser/gtk/collected_cookies_gtk.cc @@ -346,7 +346,7 @@ void CollectedCookiesGtk::AddExceptions(GtkTreeSelection* selection, if (node->CanCreateContentException()) { if (!last_domain_name.empty()) multiple_domains_added = true; - last_domain_name = node->GetTitleAsString16(); + last_domain_name = node->GetTitle(); node->CreateContentException( tab_contents_->profile()->GetHostContentSettingsMap(), setting); } diff --git a/chrome/browser/gtk/gtk_tree.cc b/chrome/browser/gtk/gtk_tree.cc index 9d0b40a..27b2813 100644 --- a/chrome/browser/gtk/gtk_tree.cc +++ b/chrome/browser/gtk/gtk_tree.cc @@ -202,7 +202,7 @@ void TreeAdapter::FillRow(GtkTreeIter* iter, TreeModelNode* node) { pixbuf = GtkThemeProvider::GetFolderIcon(true); gtk_tree_store_set(tree_store_, iter, COL_ICON, pixbuf, - COL_TITLE, UTF16ToUTF8(node->GetTitleAsString16()).c_str(), + COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), COL_NODE_PTR, node, -1); } diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index 255e466..94e4d9e 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -32,6 +32,7 @@ #include "base/scoped_vector.h" #include "base/string_util.h" #include "base/task.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_item.h" #include "chrome/browser/history/history.h" diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc index 2ba3156..ba8b27d 100644 --- a/chrome/browser/history/starred_url_database.cc +++ b/chrome/browser/history/starred_url_database.cc @@ -11,6 +11,7 @@ #include "base/scoped_vector.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_codec.h" #include "chrome/browser/bookmarks/bookmark_model.h" diff --git a/chrome/browser/history/starred_url_database_unittest.cc b/chrome/browser/history/starred_url_database_unittest.cc index f82e645..deb9750 100644 --- a/chrome/browser/history/starred_url_database_unittest.cc +++ b/chrome/browser/history/starred_url_database_unittest.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/starred_url_database.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 5f0adca..57b095a 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -24,6 +24,7 @@ #include "base/string_util.h" #include "base/time.h" #include "base/values.h" +#include "base/utf_string_conversions.h" #include "base/win_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/importer/importer_bridge.h" diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index 0f89283..5833f2d 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -101,7 +101,7 @@ void ProfileWriter::AddBookmarkEntry( const BookmarkNode* node = parent->GetChild(index); if ((node->type() == BookmarkNode::BOOKMARK_BAR || node->type() == BookmarkNode::FOLDER) && - node->GetTitleAsString16() == WideToUTF16Hack(folder_name)) { + node->GetTitle() == WideToUTF16Hack(folder_name)) { child = node; break; } @@ -286,7 +286,7 @@ std::wstring ProfileWriter::GenerateUniqueFolderName( for (int i = 0, child_count = other->GetChildCount(); i < child_count; ++i) { const BookmarkNode* node = other->GetChild(i); if (node->is_folder()) - other_folder_names.insert(UTF16ToWideHack(node->GetTitleAsString16())); + other_folder_names.insert(UTF16ToWideHack(node->GetTitle())); } if (other_folder_names.find(folder_name) == other_folder_names.end()) @@ -314,7 +314,7 @@ bool ProfileWriter::DoesBookmarkExist( for (size_t i = 0; i < nodes_with_same_url.size(); ++i) { const BookmarkNode* node = nodes_with_same_url[i]; - if (WideToUTF16Hack(entry.title) != node->GetTitleAsString16()) + if (WideToUTF16Hack(entry.title) != node->GetTitle()) continue; // Does the path match? diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index a27d2cf..b6d4c3f 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -169,6 +169,7 @@ #include "base/md5.h" #include "base/string_number_conversions.h" #include "base/thread.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_list.h" diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index 6fcdf69..42764e5 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -51,7 +51,7 @@ void BookmarkChangeProcessor::UpdateSyncNodeProperties( const BookmarkNode* src, BookmarkModel* model, sync_api::WriteNode* dst) { // Set the properties of the item. dst->SetIsFolder(src->is_folder()); - dst->SetTitle(UTF16ToWideHack(src->GetTitleAsString16())); + dst->SetTitle(UTF16ToWideHack(src->GetTitle())); if (!src->is_folder()) dst->SetURL(src->GetURL()); SetSyncNodeFavicon(src, model, dst); diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc index b52932e..ae95398 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.cc +++ b/chrome/browser/sync/glue/bookmark_model_associator.cc @@ -54,8 +54,7 @@ class BookmarkComparer { if (node1->is_folder() != node2->is_folder()) return node1->is_folder(); - int result = - node1->GetTitleAsString16().compare(node2->GetTitleAsString16()); + int result = node1->GetTitle().compare(node2->GetTitle()); if (result != 0) return result < 0; @@ -258,7 +257,7 @@ bool BookmarkModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { bool BookmarkModelAssociator::NodesMatch(const BookmarkNode* bookmark, const sync_api::BaseNode* sync_node) const { - if (bookmark->GetTitleAsString16() != WideToUTF16Hack(sync_node->GetTitle())) + if (bookmark->GetTitle() != WideToUTF16Hack(sync_node->GetTitle())) return false; if (bookmark->is_folder() != sync_node->GetIsFolder()) return false; diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc index c80426f..d6abc39 100644 --- a/chrome/browser/sync/glue/typed_url_change_processor.cc +++ b/chrome/browser/sync/glue/typed_url_change_processor.cc @@ -5,6 +5,7 @@ #include "chrome/browser/sync/glue/typed_url_change_processor.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/history/history_backend.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index c60e6c2..bb366c7 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -299,7 +299,7 @@ class ProfileSyncServiceTest : public testing::Test { // Non-root node titles and parents must match. if (bnode != model_->GetBookmarkBarNode() && bnode != model_->other_node()) { - EXPECT_EQ(bnode->GetTitleAsString16(), WideToUTF16Hack(gnode.GetTitle())); + EXPECT_EQ(bnode->GetTitle(), WideToUTF16Hack(gnode.GetTitle())); EXPECT_EQ(associator()->GetChromeNodeFromSyncId(gnode.GetParentId()), bnode->GetParent()); } @@ -374,7 +374,7 @@ class ProfileSyncServiceTest : public testing::Test { const BookmarkNode* bnode = associator()->GetChromeNodeFromSyncId(sync_id); ASSERT_TRUE(bnode); - EXPECT_EQ(bnode->GetTitleAsString16(), WideToUTF16Hack(title)); + EXPECT_EQ(bnode->GetTitle(), WideToUTF16Hack(title)); } void ExpectBrowserNodeURL(int64 sync_id, const std::string& url) { @@ -996,7 +996,7 @@ void ProfileSyncServiceTestWithData::CompareWithTestData( for (int i = 0; i < size; ++i) { const BookmarkNode* child_node = node->GetChild(i); const TestData& item = data[i]; - EXPECT_EQ(child_node->GetTitleAsString16(), WideToUTF16Hack(item.title)); + EXPECT_EQ(child_node->GetTitle(), WideToUTF16Hack(item.title)); if (item.url) { EXPECT_FALSE(child_node->is_folder()); EXPECT_TRUE(child_node->is_url()); diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h index 9428235..baaceb6 100644 --- a/chrome/browser/sync/profile_sync_test_util.h +++ b/chrome/browser/sync/profile_sync_test_util.h @@ -15,6 +15,7 @@ #include "base/task.h" #include "base/thread.h" #include "base/waitable_event.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/webdata/web_database.h" diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index a21ea8f..b22c2f8 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -18,6 +18,7 @@ #include "base/process_util.h" #include "base/string16.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/time.h" #include "chrome/browser/autocomplete_history_manager.h" #include "chrome/browser/autofill/autofill_manager.h" diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index c741807..4aeab9c 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -15,6 +15,7 @@ #include "app/text_elider.h" #include "base/i18n/rtl.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" @@ -1257,12 +1258,12 @@ void BookmarkBarView::ShowContextMenu(View* source, views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { if (node->is_url()) { BookmarkButton* button = new BookmarkButton(this, node->GetURL(), - UTF16ToWide(node->GetTitleAsString16()), GetProfile()); + UTF16ToWide(node->GetTitle()), GetProfile()); ConfigureButton(node, button); return button; } else { views::MenuButton* button = new BookmarkFolderButton(this, - UTF16ToWide(node->GetTitleAsString16()), this, false); + UTF16ToWide(node->GetTitle()), this, false); button->SetIcon(GetGroupIcon()); ConfigureButton(node, button); return button; @@ -1271,8 +1272,8 @@ views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { void BookmarkBarView::ConfigureButton(const BookmarkNode* node, views::TextButton* button) { - button->SetText(UTF16ToWide(node->GetTitleAsString16())); - button->SetAccessibleName(UTF16ToWide(node->GetTitleAsString16())); + button->SetText(UTF16ToWide(node->GetTitle())); + button->SetAccessibleName(UTF16ToWide(node->GetTitle())); button->SetID(VIEW_ID_BOOKMARK_BAR_ELEMENT); // We don't always have a theme provider (ui tests, for example). if (GetThemeProvider()) { diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index 61ba2c3..96065eb 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -266,7 +266,7 @@ string16 BookmarkBubbleView::GetTitle() { const BookmarkNode* node = bookmark_model->GetMostRecentlyAddedNodeForURL(url_); if (node) - return node->GetTitleAsString16(); + return node->GetTitle(); else NOTREACHED(); return string16(); @@ -392,7 +392,7 @@ void BookmarkBubbleView::ApplyEdits() { const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); if (node) { const string16 new_title = title_tf_->text(); - if (new_title != node->GetTitleAsString16()) { + if (new_title != node->GetTitle()) { model->SetTitle(node, new_title); UserMetrics::RecordAction( UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"), diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index 9a0726e..9bf525c 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -489,7 +489,7 @@ void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node, const BookmarkNode* child_bb_node = bb_node->GetChild(i); if (child_bb_node->is_folder()) { EditorNode* new_b_node = - new EditorNode(WideToUTF16(child_bb_node->GetTitleAsString16()), + new EditorNode(WideToUTF16(child_bb_node->GetTitle()), child_bb_node->id()); b_node->Add(b_node->GetChildCount(), new_b_node); CreateNodes(child_bb_node, new_b_node); @@ -561,7 +561,7 @@ void BookmarkEditorView::ApplyNameChangesAndCreateNewGroups( if (child_b_node->value == 0) { // New group. child_bb_node = bb_model_->AddGroup(bb_node, - bb_node->GetChildCount(), child_b_node->GetTitleAsString16()); + bb_node->GetChildCount(), child_b_node->GetTitle()); } else { // Existing node, reset the title (BBModel ignores changes if the title // is the same). @@ -573,7 +573,7 @@ void BookmarkEditorView::ApplyNameChangesAndCreateNewGroups( } } DCHECK(child_bb_node); - bb_model_->SetTitle(child_bb_node, child_b_node->GetTitleAsString16()); + bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); } ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, parent_b_node, parent_bb_node); diff --git a/chrome/browser/views/bookmark_editor_view_unittest.cc b/chrome/browser/views/bookmark_editor_view_unittest.cc index 6ce3a31..95a095a 100644 --- a/chrome/browser/views/bookmark_editor_view_unittest.cc +++ b/chrome/browser/views/bookmark_editor_view_unittest.cc @@ -4,6 +4,7 @@ #include "base/message_loop.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/prefs/pref_service.h" @@ -138,18 +139,17 @@ TEST_F(BookmarkEditorViewTest, ModelsMatch) { BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); // The root should have 2 nodes: folder F1 and F2. ASSERT_EQ(2, bb_node->GetChildCount()); - ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitleAsString16()); - ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); // F1 should have one child, F11 ASSERT_EQ(1, bb_node->GetChild(0)->GetChildCount()); - ASSERT_EQ(ASCIIToUTF16("F11"), - bb_node->GetChild(0)->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); BookmarkEditorView::EditorNode* other_node = editor_root->GetChild(1); // Other node should have one child (OF1). ASSERT_EQ(1, other_node->GetChildCount()); - ASSERT_EQ(ASCIIToUTF16("OF1"), other_node->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("OF1"), other_node->GetChild(0)->GetTitle()); } // Changes the title and makes sure parent/visual order doesn't change. @@ -162,7 +162,7 @@ TEST_F(BookmarkEditorViewTest, EditTitleKeepsPosition) { const BookmarkNode* bb_node = profile_->GetBookmarkModel()->GetBookmarkBarNode(); - ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitle()); // The URL shouldn't have changed. ASSERT_TRUE(GURL(base_path() + "a") == bb_node->GetChild(0)->GetURL()); } @@ -180,7 +180,7 @@ TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) { const BookmarkNode* bb_node = profile_->GetBookmarkModel()->GetBookmarkBarNode(); - ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitle()); // The URL should have changed. ASSERT_TRUE(GURL(base_path() + "new_a") == bb_node->GetChild(0)->GetURL()); ASSERT_TRUE(node_time == bb_node->GetChild(0)->date_added()); @@ -194,7 +194,7 @@ TEST_F(BookmarkEditorViewTest, ChangeParent) { ApplyEdits(editor_tree_model()->GetRoot()->GetChild(1)); const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); - ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); ASSERT_TRUE(GURL(base_path() + "a") == other_node->GetChild(2)->GetURL()); } @@ -210,7 +210,7 @@ TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) { ApplyEdits(editor_tree_model()->GetRoot()->GetChild(1)); const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); - ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitle()); ASSERT_TRUE(GURL(base_path() + "new_a") == other_node->GetChild(2)->GetURL()); ASSERT_TRUE(node_time == other_node->GetChild(2)->date_added()); } @@ -238,14 +238,14 @@ TEST_F(BookmarkEditorViewTest, MoveToNewParent) { // F2 in the model should have two children now: F21 and the node edited. ASSERT_EQ(2, mf2->GetChildCount()); // F21 should be first. - ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitle()); // Then a. - ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitle()); // F21 should have one child, F211. const BookmarkNode* mf21 = mf2->GetChild(0); ASSERT_EQ(1, mf21->GetChildCount()); - ASSERT_EQ(ASCIIToUTF16("F211"), mf21->GetChild(0)->GetTitleAsString16()); + ASSERT_EQ(ASCIIToUTF16("F211"), mf21->GetChild(0)->GetTitle()); } // Brings up the editor, creating a new URL on the bookmark bar. @@ -264,7 +264,7 @@ TEST_F(BookmarkEditorViewTest, NewURL) { const BookmarkNode* new_node = bb_node->GetChild(3); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); } @@ -284,7 +284,7 @@ TEST_F(BookmarkEditorViewTest, ChangeURLNoTree) { const BookmarkNode* new_node = other_node->GetChild(0); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); } @@ -303,7 +303,7 @@ TEST_F(BookmarkEditorViewTest, ChangeTitleNoTree) { const BookmarkNode* new_node = other_node->GetChild(0); - EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); } // Creates a new folder. @@ -326,14 +326,13 @@ TEST_F(BookmarkEditorViewTest, NewFolder) { const BookmarkNode* new_node = model_->GetBookmarkBarNode()->GetChild(3); EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); - EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); // The node should have one child. ASSERT_EQ(1, new_node->GetChildCount()); const BookmarkNode* new_child = new_node->GetChild(0); // Make sure the child url/title match. EXPECT_EQ(BookmarkNode::URL, new_child->type()); - EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), - new_child->GetTitleAsString16()); + EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle()); EXPECT_EQ(details.urls[0].first, new_child->GetURL()); } @@ -356,13 +355,12 @@ TEST_F(BookmarkEditorViewTest, MoveFolder) { ASSERT_EQ(3, model_->other_node()->GetChildCount()); const BookmarkNode* new_node = model_->other_node()->GetChild(2); EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); - EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitleAsString16()); + EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); // The node should have one child. ASSERT_EQ(1, new_node->GetChildCount()); const BookmarkNode* new_child = new_node->GetChild(0); // Make sure the child url/title match. EXPECT_EQ(BookmarkNode::URL, new_child->type()); - EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), - new_child->GetTitleAsString16()); + EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle()); EXPECT_EQ(details.urls[0].first, new_child->GetURL()); } diff --git a/chrome/browser/views/bookmark_menu_controller_views.cc b/chrome/browser/views/bookmark_menu_controller_views.cc index fd8171e..dfc500d 100644 --- a/chrome/browser/views/bookmark_menu_controller_views.cc +++ b/chrome/browser/views/bookmark_menu_controller_views.cc @@ -7,6 +7,7 @@ #include "app/os_exchange_data.h" #include "app/resource_bundle.h" #include "base/stl_util-inl.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -319,14 +320,13 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, icon = *ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_DEFAULT_FAVICON); } - menu->AppendMenuItemWithIcon(id, UTF16ToWide(node->GetTitleAsString16()), - icon); + menu->AppendMenuItemWithIcon(id, UTF16ToWide(node->GetTitle()), icon); node_to_menu_id_map_[node] = id; } else if (node->is_folder()) { SkBitmap* folder_icon = ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); MenuItemView* submenu = menu->AppendSubMenuWithIcon(id, - UTF16ToWide(node->GetTitleAsString16()), *folder_icon); + UTF16ToWide(node->GetTitle()), *folder_icon); node_to_menu_id_map_[node] = id; BuildMenu(node, 0, submenu, next_menu_id); } else { diff --git a/chrome/test/live_sync/bookmark_model_verifier.cc b/chrome/test/live_sync/bookmark_model_verifier.cc index c356be3..e2edd8b 100644 --- a/chrome/test/live_sync/bookmark_model_verifier.cc +++ b/chrome/test/live_sync/bookmark_model_verifier.cc @@ -157,7 +157,7 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup( int random_int = base::RandInt(1, 100); // To create randomness in order, 60% of time add bookmarks if (random_int > 40) { - wstring child_bm_title(bm_folder->GetTitle()); + wstring child_bm_title(UTF16ToWideHack(bm_folder->GetTitle())); child_bm_title.append(L"-ChildBM"); child_bm_title.append(UTF8ToWide(base::IntToString(index))); string url("http://www.nofaviconurl"); @@ -168,7 +168,7 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup( EXPECT_TRUE(child_nofavicon_bm != NULL); } else { // Remaining % of time - Add Bookmark folders - wstring child_bmfolder_title(bm_folder->GetTitle()); + wstring child_bmfolder_title(UTF16ToWideHack(bm_folder->GetTitle())); child_bmfolder_title.append(L"-ChildBMFolder"); child_bmfolder_title.append(UTF8ToWide(base::IntToString(index))); const BookmarkNode* child_bm_folder = @@ -251,9 +251,8 @@ const BookmarkNode* BookmarkModelVerifier::SetURL(BookmarkModel* model, FindNodeInVerifier(model, node, &v_node); const BookmarkNode* result = bookmark_utils::ApplyEditsWithNoGroupChange( model, node->GetParent(), BookmarkEditor::EditDetails(node), - node->GetTitleAsString16(), new_url); + node->GetTitle(), new_url); bookmark_utils::ApplyEditsWithNoGroupChange(model_, v_node->GetParent(), - BookmarkEditor::EditDetails(v_node), v_node->GetTitleAsString16(), - new_url); + BookmarkEditor::EditDetails(v_node), v_node->GetTitle(), new_url); return result; } diff --git a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc index 06846a4..d853e26 100644 --- a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc +++ b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc @@ -1476,7 +1476,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bm_folder. int child_count = base::RandInt(0, 10); for (int index = 0; index < child_count; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1544,7 +1544,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bm_folder. int child_count = base::RandInt(0, 10); for (int index = 0; index < child_count; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1615,7 +1615,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bm_folder. int child_count = base::RandInt(0, 10); for (int index = 0; index < child_count; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1670,7 +1670,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some bookmarks (without favicon) to bm_folder. int child_count = base::RandInt(0, 10); for (int index = 0; index < child_count; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1694,7 +1694,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, bm_bar0, bm_bar0->GetChildCount(), L"MyTest BMFolder"); // Let's add few bookmarks to my_bm_folder. for (int index = 0; index < 10; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1737,7 +1737,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, // Let's add some GetBookmarkModel(without favicon) to bm_folder. int child_count = base::RandInt(0, 10); for (int index = 0; index < child_count; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); @@ -1761,7 +1761,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, bm_folder_L5, bm_folder_L5->GetChildCount(), L"MyTest BMFolder"); // Let's add few bookmarks to my_bm_folder. for (int index = 0; index < 10; index++) { - wstring title(bm_folder->GetTitle()); + wstring title(UTF16ToWideHack(bm_folder->GetTitle())); title.append(L"-BM"); string url("http://www.nofaviconurl-"); title.append(IntToWStringHack(index)); diff --git a/chrome/test/model_test_utils.cc b/chrome/test/model_test_utils.cc index d430c7e..27a1d79 100644 --- a/chrome/test/model_test_utils.cc +++ b/chrome/test/model_test_utils.cc @@ -18,10 +18,10 @@ std::string ModelStringFromNode(const BookmarkNode* node) { for (int i = 0; i < child_count; ++i) { const BookmarkNode* child = node->GetChild(i); if (child->is_folder()) { - child_string += UTF16ToUTF8(child->GetTitleAsString16()) + ":[ " + + child_string += UTF16ToUTF8(child->GetTitle()) + ":[ " + ModelStringFromNode(child) + "] "; } else { - child_string += UTF16ToUTF8(child->GetTitleAsString16()) + " "; + child_string += UTF16ToUTF8(child->GetTitle()) + " "; } } return child_string; |