diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-29 00:45:28 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-29 00:45:28 +0000 |
commit | 44063b4e3ea781d1f9cbfd392e2cec56a8f54509 (patch) | |
tree | c582c8bbd42e37dd07534273882ca05719d9f78e | |
parent | 969894aba3265e77edafbc6556941ea693485cd8 (diff) | |
download | chromium_src-44063b4e3ea781d1f9cbfd392e2cec56a8f54509.zip chromium_src-44063b4e3ea781d1f9cbfd392e2cec56a8f54509.tar.gz chromium_src-44063b4e3ea781d1f9cbfd392e2cec56a8f54509.tar.bz2 |
Remove wstrings from bookmarks, part 17.
This converts lots of (wstring) GetTitle()s to (string16) GetTitleAsString16().
Soon, I'll be able to delete the former, and rename the latter (s/AsString16//).
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3226004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57800 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 62 insertions, 56 deletions
diff --git a/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm b/chrome/browser/cocoa/applescript/bookmark_node_applescript.mm index 1b36d05..a1aa22c 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::SysWideToNSString(bookmarkNode_->GetTitle()); + return base::SysUTF16ToNSString(bookmarkNode_->GetTitleAsString16()); } - (void)setTitle:(NSString*)aTitle { diff --git a/chrome/browser/dom_ui/cookies_view_handler.cc b/chrome/browser/dom_ui/cookies_view_handler.cc index d158e53..0453ced 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, WideToUTF8(node.GetTitle())); + dict->SetString(kKeyTitle, node.GetTitleAsString16()); switch (node.GetDetailedInfo().node_type) { case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: { diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index 9e6fa50..1b3a986 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -628,7 +628,7 @@ class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { if (!parent) return; - std::string bucket_id = WideToUTF8(parent->GetTitle()); + std::string bucket_id = UTF16ToUTF8(parent->GetTitleAsString16()); 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 += WideToUTF8(node->GetParent()->GetTitle()); - bucket_id += WideToUTF8(node->GetTitle()); + bucket_id += UTF16ToUTF8(node->GetParent()->GetTitleAsString16()); + bucket_id += UTF16ToUTF8(node->GetTitleAsString16()); bucket_id += node->GetURL().spec(); buckets->push_back(GetBucket(base::SHA1HashString(bucket_id))); } diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.cc b/chrome/browser/gtk/bookmark_bubble_gtk.cc index 0593453a..eeb7833 100644 --- a/chrome/browser/gtk/bookmark_bubble_gtk.cc +++ b/chrome/browser/gtk/bookmark_bubble_gtk.cc @@ -305,7 +305,7 @@ std::string BookmarkBubbleGtk::GetTitle() { return std::string(); } - return WideToUTF8(node->GetTitle()); + return UTF16ToUTF8(node->GetTitleAsString16()); } void BookmarkBubbleGtk::ShowEditor() { diff --git a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc b/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc index 43b293a..37a696b 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(L"new_a", bb_node->GetChild(0)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("new_a"), bb_node->GetChild(0)->GetTitleAsString16()); // 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(L"a", bb_node->GetChild(0)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("a"), bb_node->GetChild(0)->GetTitleAsString16()); // 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(L"a", other_node->GetChild(2)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); 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(L"a", other_node->GetChild(2)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("a"), other_node->GetChild(2)->GetTitleAsString16()); 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(L"F21", mf2->GetChild(0)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("F21"), mf2->GetChild(0)->GetTitleAsString16()); // Then a. - ASSERT_EQ(L"a", mf2->GetChild(1)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("a"), mf2->GetChild(1)->GetTitleAsString16()); // F21 should have one child, F211. const BookmarkNode* mf21 = mf2->GetChild(0); ASSERT_EQ(1, mf21->GetChildCount()); - ASSERT_EQ(L"F211", mf21->GetChild(0)->GetTitle()); + ASSERT_EQ(ASCIIToUTF16("F211"), mf21->GetChild(0)->GetTitleAsString16()); } // 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(L"new_a", new_node->GetTitle()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); 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(L"new_a", new_node->GetTitle()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); 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(L"new_a", new_node->GetTitle()); + EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitleAsString16()); } diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc index 0a1753f..dd5abe2 100644 --- a/chrome/browser/gtk/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/gtk/bookmark_menu_controller_gtk.cc @@ -146,10 +146,11 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, // This breaks on word boundaries. Ideally we would break on character // boundaries. - std::wstring elided_name = - l10n_util::TruncateString(node->GetTitle(), kMaxChars); + std::string elided_name = WideToUTF8( + l10n_util::TruncateString(UTF16ToWideHack(node->GetTitleAsString16()), + kMaxChars)); GtkWidget* menu_item = - gtk_image_menu_item_new_with_label(WideToUTF8(elided_name).c_str()); + gtk_image_menu_item_new_with_label(elided_name.c_str()); g_object_set_data(G_OBJECT(menu_item), "bookmark-node", AsVoid(node)); SetImageMenuItem(menu_item, node, profile_->GetBookmarkModel()); gtk_util::SetAlwaysShowImage(menu_item); diff --git a/chrome/browser/gtk/bookmark_tree_model.cc b/chrome/browser/gtk/bookmark_tree_model.cc index ab697ba..041b0b6 100644 --- a/chrome/browser/gtk/bookmark_tree_model.cc +++ b/chrome/browser/gtk/bookmark_tree_model.cc @@ -25,7 +25,8 @@ void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, // differently). gtk_tree_store_set(store, iter, bookmark_utils::FOLDER_ICON, GtkThemeProvider::GetFolderIcon(true), - bookmark_utils::FOLDER_NAME, WideToUTF8(node->GetTitle()).c_str(), + bookmark_utils::FOLDER_NAME, + UTF16ToUTF8(node->GetTitleAsString16()).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 1e6eec9..3cb4bc4e8 100644 --- a/chrome/browser/gtk/bookmark_utils_gtk.cc +++ b/chrome/browser/gtk/bookmark_utils_gtk.cc @@ -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 = WideToUTF8(node->GetTitle()); + const std::string& title = UTF16ToUTF8(node->GetTitleAsString16()); 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( - node->GetTitle(), kMaxTooltipTitleLength)); + UTF16ToWideHack(node->GetTitleAsString16()), kMaxTooltipTitleLength)); gchar* escaped_title_cstr = g_markup_escape_text(truncated_title.c_str(), truncated_title.size()); std::string escaped_title(escaped_title_cstr); diff --git a/chrome/browser/gtk/gtk_tree.cc b/chrome/browser/gtk/gtk_tree.cc index eeb4511..9d0b40a 100644 --- a/chrome/browser/gtk/gtk_tree.cc +++ b/chrome/browser/gtk/gtk_tree.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -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, WideToUTF8(node->GetTitle()).c_str(), + COL_TITLE, UTF16ToUTF8(node->GetTitleAsString16()).c_str(), COL_NODE_PTR, node, -1); } diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index 671b860..0f89283 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->GetTitle() == folder_name) { + node->GetTitleAsString16() == 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(node->GetTitle()); + other_folder_names.insert(UTF16ToWideHack(node->GetTitleAsString16())); } 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 (entry.title != node->GetTitle()) + if (WideToUTF16Hack(entry.title) != node->GetTitleAsString16()) continue; // Does the path match? diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index 03cce0b..6fcdf69 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(src->GetTitle()); + dst->SetTitle(UTF16ToWideHack(src->GetTitleAsString16())); 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 6d9d96aa..b52932e 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.cc +++ b/chrome/browser/sync/glue/bookmark_model_associator.cc @@ -54,7 +54,8 @@ class BookmarkComparer { if (node1->is_folder() != node2->is_folder()) return node1->is_folder(); - int result = node1->GetTitle().compare(node2->GetTitle()); + int result = + node1->GetTitleAsString16().compare(node2->GetTitleAsString16()); if (result != 0) return result < 0; @@ -257,7 +258,7 @@ bool BookmarkModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { bool BookmarkModelAssociator::NodesMatch(const BookmarkNode* bookmark, const sync_api::BaseNode* sync_node) const { - if (bookmark->GetTitle() != sync_node->GetTitle()) + if (bookmark->GetTitleAsString16() != WideToUTF16Hack(sync_node->GetTitle())) return false; if (bookmark->is_folder() != sync_node->GetIsFolder()) return false; diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 692f6b5..c60e6c2 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->GetTitle(), gnode.GetTitle()); + EXPECT_EQ(bnode->GetTitleAsString16(), 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->GetTitle(), title); + EXPECT_EQ(bnode->GetTitleAsString16(), WideToUTF16Hack(title)); } void ExpectBrowserNodeURL(int64 sync_id, const std::string& url) { @@ -996,11 +996,11 @@ void ProfileSyncServiceTestWithData::CompareWithTestData( for (int i = 0; i < size; ++i) { const BookmarkNode* child_node = node->GetChild(i); const TestData& item = data[i]; - EXPECT_TRUE(child_node->GetTitle() == item.title); + EXPECT_EQ(child_node->GetTitleAsString16(), WideToUTF16Hack(item.title)); if (item.url) { EXPECT_FALSE(child_node->is_folder()); EXPECT_TRUE(child_node->is_url()); - EXPECT_TRUE(child_node->GetURL() == GURL(item.url)); + EXPECT_EQ(child_node->GetURL(), GURL(item.url)); } else { EXPECT_TRUE(child_node->is_folder()); EXPECT_FALSE(child_node->is_url()); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 80fcc6f..c741807 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1256,15 +1256,13 @@ void BookmarkBarView::ShowContextMenu(View* source, views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { if (node->is_url()) { - BookmarkButton* button = new BookmarkButton(this, - node->GetURL(), - node->GetTitle(), - GetProfile()); + BookmarkButton* button = new BookmarkButton(this, node->GetURL(), + UTF16ToWide(node->GetTitleAsString16()), GetProfile()); ConfigureButton(node, button); return button; } else { - views::MenuButton* button = - new BookmarkFolderButton(this, node->GetTitle(), this, false); + views::MenuButton* button = new BookmarkFolderButton(this, + UTF16ToWide(node->GetTitleAsString16()), this, false); button->SetIcon(GetGroupIcon()); ConfigureButton(node, button); return button; @@ -1273,8 +1271,8 @@ views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { void BookmarkBarView::ConfigureButton(const BookmarkNode* node, views::TextButton* button) { - button->SetText(node->GetTitle()); - button->SetAccessibleName(node->GetTitle()); + button->SetText(UTF16ToWide(node->GetTitleAsString16())); + button->SetAccessibleName(UTF16ToWide(node->GetTitleAsString16())); 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 9fda102..61ba2c3 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -246,7 +246,7 @@ void BookmarkBubbleView::Init() { layout->AddView( new Label(l10n_util::GetString(IDS_BOOMARK_BUBBLE_TITLE_TEXT))); title_tf_ = new views::Textfield(); - title_tf_->SetText(WideToUTF16(GetTitle())); + title_tf_->SetText(GetTitle()); layout->AddView(title_tf_); layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); @@ -261,15 +261,15 @@ void BookmarkBubbleView::Init() { layout->AddView(close_button_); } -std::wstring BookmarkBubbleView::GetTitle() { +string16 BookmarkBubbleView::GetTitle() { BookmarkModel* bookmark_model= profile_->GetBookmarkModel(); const BookmarkNode* node = bookmark_model->GetMostRecentlyAddedNodeForURL(url_); if (node) - return node->GetTitle(); + return node->GetTitleAsString16(); else NOTREACHED(); - return std::wstring(); + return string16(); } void BookmarkBubbleView::ButtonPressed( diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h index 29528fb..32a928f 100644 --- a/chrome/browser/views/bookmark_bubble_view.h +++ b/chrome/browser/views/bookmark_bubble_view.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_ #pragma once +#include "base/string16.h" #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" #include "chrome/browser/views/info_bubble.h" #include "gfx/rect.h" @@ -74,7 +75,7 @@ class BookmarkBubbleView : public views::View, void Init(); // Returns the title to display. - std::wstring GetTitle(); + string16 GetTitle(); // LinkController method, either unstars the item or shows the bookmark // editor (depending upon which link was clicked). diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index 619c01f..9a0726e 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -488,8 +488,9 @@ void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node, for (int i = 0; i < bb_node->GetChildCount(); ++i) { const BookmarkNode* child_bb_node = bb_node->GetChild(i); if (child_bb_node->is_folder()) { - EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), - child_bb_node->id()); + EditorNode* new_b_node = + new EditorNode(WideToUTF16(child_bb_node->GetTitleAsString16()), + child_bb_node->id()); b_node->Add(b_node->GetChildCount(), new_b_node); CreateNodes(child_bb_node, new_b_node); } diff --git a/chrome/browser/views/bookmark_editor_view_unittest.cc b/chrome/browser/views/bookmark_editor_view_unittest.cc index 07803be..6ce3a31 100644 --- a/chrome/browser/views/bookmark_editor_view_unittest.cc +++ b/chrome/browser/views/bookmark_editor_view_unittest.cc @@ -332,8 +332,9 @@ TEST_F(BookmarkEditorViewTest, NewFolder) { const BookmarkNode* new_child = new_node->GetChild(0); // Make sure the child url/title match. EXPECT_EQ(BookmarkNode::URL, new_child->type()); - EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); - EXPECT_TRUE(details.urls[0].first == new_child->GetURL()); + EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), + new_child->GetTitleAsString16()); + EXPECT_EQ(details.urls[0].first, new_child->GetURL()); } // Creates a new folder and selects a different folder for the folder to appear @@ -361,6 +362,7 @@ TEST_F(BookmarkEditorViewTest, MoveFolder) { const BookmarkNode* new_child = new_node->GetChild(0); // Make sure the child url/title match. EXPECT_EQ(BookmarkNode::URL, new_child->type()); - EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); - EXPECT_TRUE(details.urls[0].first == new_child->GetURL()); + EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), + new_child->GetTitleAsString16()); + 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 cabef91..fd8171e 100644 --- a/chrome/browser/views/bookmark_menu_controller_views.cc +++ b/chrome/browser/views/bookmark_menu_controller_views.cc @@ -319,13 +319,14 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, icon = *ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_DEFAULT_FAVICON); } - menu->AppendMenuItemWithIcon(id, node->GetTitle(), icon); + menu->AppendMenuItemWithIcon(id, UTF16ToWide(node->GetTitleAsString16()), + 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, node->GetTitle(), *folder_icon); + MenuItemView* submenu = menu->AppendSubMenuWithIcon(id, + UTF16ToWide(node->GetTitleAsString16()), *folder_icon); node_to_menu_id_map_[node] = id; BuildMenu(node, 0, submenu, next_menu_id); } else { |