diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 00:00:33 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 00:00:33 +0000 |
commit | 944b421354f362504551764c7efb9f2d0d226c1e (patch) | |
tree | edf5ca3976dedbc243425e9463621f6ccfc7e905 | |
parent | ccd875e758bbec05869f3ad4ba6122a624742295 (diff) | |
download | chromium_src-944b421354f362504551764c7efb9f2d0d226c1e.zip chromium_src-944b421354f362504551764c7efb9f2d0d226c1e.tar.gz chromium_src-944b421354f362504551764c7efb9f2d0d226c1e.tar.bz2 |
webkit: use string16 in ContextMenuParams
BUG=23581
TEST=compiles
Review URL: http://codereview.chromium.org/5712003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69074 0039d316-1c4b-4281-b951-d872f2087c98
10 files changed, 18 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index c26dd0d..08d95c5 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "app/menus/menu_model.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/extensions/extension_browsertest.h" diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc index 4f4d72f..1a8041e 100644 --- a/chrome/browser/extensions/extension_menu_manager.cc +++ b/chrome/browser/extensions/extension_menu_manager.cc @@ -410,8 +410,7 @@ void ExtensionMenuManager::ExecuteCommand( AddURLProperty(properties, "frameUrl", params.frame_url); if (params.selection_text.length() > 0) - properties->SetString("selectionText", - WideToUTF16Hack(params.selection_text)); + properties->SetString("selectionText", params.selection_text); properties->SetBoolean("editable", params.is_editable); diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc index cbd9a52..ff22542 100644 --- a/chrome/browser/extensions/extension_menu_manager_unittest.cc +++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc @@ -8,6 +8,7 @@ #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/scoped_vector.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/extensions/extension_event_router.h" @@ -419,7 +420,7 @@ TEST_F(ExtensionMenuManagerTest, ExecuteCommand) { params.media_type = WebKit::WebContextMenuData::MediaTypeImage; params.src_url = GURL("http://foo.bar/image.png"); params.page_url = GURL("http://foo.bar"); - params.selection_text = L"Hello World"; + params.selection_text = ASCIIToUTF16("Hello World"); params.is_editable = false; Extension* extension = AddExtension("test"); @@ -471,8 +472,9 @@ TEST_F(ExtensionMenuManagerTest, ExecuteCommand) { ASSERT_TRUE(info->GetString("pageUrl", &tmp)); ASSERT_EQ(params.page_url.spec(), tmp); - ASSERT_TRUE(info->GetString("selectionText", &tmp)); - ASSERT_EQ(WideToUTF8(params.selection_text), tmp); + string16 tmp16; + ASSERT_TRUE(info->GetString("selectionText", &tmp16)); + ASSERT_EQ(params.selection_text, tmp16); bool bool_tmp = true; ASSERT_TRUE(info->GetBoolean("editable", &bool_tmp)); diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index e40f45c..6127769 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -11,6 +11,7 @@ #include "base/debug/trace_event.h" #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "base/win_util.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_dll_resource.h" diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 095fa82..1b1cf0b 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -14,6 +14,7 @@ #include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 7a8265c..a0cb149 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -14,6 +14,7 @@ #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" @@ -575,7 +576,8 @@ void RenderViewContextMenu::AppendSearchProvider() { return; AutocompleteMatch match; - profile_->GetAutocompleteClassifier()->Classify(params_.selection_text, + profile_->GetAutocompleteClassifier()->Classify( + UTF16ToWideHack(params_.selection_text), std::wstring(), false, &match, NULL); selection_navigation_url_ = match.destination_url; if (!selection_navigation_url_.is_valid()) @@ -1430,7 +1432,7 @@ bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { } string16 RenderViewContextMenu::PrintableSelectionText() { - return l10n_util::TruncateString(WideToUTF16Hack(params_.selection_text), + return l10n_util::TruncateString(params_.selection_text, kMaxSelectionTextLength); } diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/tab_contents/render_view_context_menu_mac.mm index 276d3b3..ef0cf60 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_mac.mm +++ b/chrome/browser/tab_contents/render_view_context_menu_mac.mm @@ -75,7 +75,7 @@ void RenderViewContextMenuMac::LookUpInDictionary() { // TODO(morrita): On Safari, A dictionary panel could be shown // based on a preference setting of Dictionary.app. We currently // don't support it: http://crbug.com/17951 - NSString* text = base::SysWideToNSString(params_.selection_text); + NSString* text = base::SysUTF16ToNSString(params_.selection_text); NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName]; // 10.5 and earlier require declareTypes before setData. // See the documentation on [NSPasteboard declareTypes]. diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index 7ec34e4..f13cfcf 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -9,6 +9,7 @@ #include <gtk/gtk.h> #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/gtk/browser_window_gtk.h" diff --git a/webkit/glue/context_menu.cc b/webkit/glue/context_menu.cc index 390d740..bdfe790 100644 --- a/webkit/glue/context_menu.cc +++ b/webkit/glue/context_menu.cc @@ -18,7 +18,7 @@ ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData& data) page_url(data.pageURL), frame_url(data.frameURL), media_flags(data.mediaFlags), - selection_text(UTF16ToWideHack(data.selectedText)), + selection_text(data.selectedText), misspelled_word(data.misspelledWord), spellcheck_enabled(data.isSpellCheckingEnabled), is_editable(data.isEditable), diff --git a/webkit/glue/context_menu.h b/webkit/glue/context_menu.h index b681a38..c87de41 100644 --- a/webkit/glue/context_menu.h +++ b/webkit/glue/context_menu.h @@ -8,7 +8,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/utf_string_conversions.h" +#include "base/string16.h" #include "googleurl/src/gurl.h" #include "webkit/glue/webmenuitem.h" @@ -57,7 +57,7 @@ struct ContextMenuParams { int media_flags; // This is the text of the selection that the context menu was invoked on. - std::wstring selection_text; + string16 selection_text; // The misspelled word under the cursor, if any. Used to generate the // |dictionary_suggestions| list. |