summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webtextinput_impl.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 01:05:27 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 01:05:27 +0000
commit7be0e1710c92420e5b15b3d0d1850a09848cf217 (patch)
tree2e78a8d47b62abcf752b502aeefe3ca01cade638 /webkit/glue/webtextinput_impl.cc
parent7912282690d4ec3a0a408af669febb4db0930119 (diff)
downloadchromium_src-7be0e1710c92420e5b15b3d0d1850a09848cf217.zip
chromium_src-7be0e1710c92420e5b15b3d0d1850a09848cf217.tar.gz
chromium_src-7be0e1710c92420e5b15b3d0d1850a09848cf217.tar.bz2
Retry r16006.
Review URL: http://codereview.chromium.org/113369 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webtextinput_impl.cc')
-rw-r--r--webkit/glue/webtextinput_impl.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/webkit/glue/webtextinput_impl.cc b/webkit/glue/webtextinput_impl.cc
index 964a01e..84dcb9b 100644
--- a/webkit/glue/webtextinput_impl.cc
+++ b/webkit/glue/webtextinput_impl.cc
@@ -14,7 +14,9 @@ MSVC_POP_WARNING();
#undef LOG
+#include "base/string16.h"
#include "base/string_util.h"
+#include "webkit/glue/glue_util.h"
#include "webkit/glue/webframe_impl.h"
#include "webkit/glue/webtextinput_impl.h"
@@ -34,18 +36,18 @@ WebCore::Editor* WebTextInputImpl::GetEditor() {
return web_frame_impl_->frame()->editor();
}
-void WebTextInputImpl::InsertText(const std::string& text) {
- WebCore::String str(text.c_str());
+void WebTextInputImpl::InsertText(const string16& text) {
+ WebCore::String str = webkit_glue::String16ToString(text);
GetEditor()->insertText(str, NULL);
}
-void WebTextInputImpl::DoCommand(const std::string& com) {
+void WebTextInputImpl::DoCommand(const string16& com) {
if (com.length() <= 2)
return;
// Since we don't have NSControl, we will convert the format of command
// string and call the function on Editor directly.
- std::string command = com;
+ string16 command = com;
// Make sure the first letter is upper case.
command.replace(0, 1, 1, toupper(command.at(0)));
@@ -56,16 +58,16 @@ void WebTextInputImpl::DoCommand(const std::string& com) {
// Specially handling commands that Editor::execCommand does not directly
// support.
- if (!command.compare("DeleteToEndOfParagraph")) {
+ if (EqualsASCII(command, "DeleteToEndOfParagraph")) {
DeleteToEndOfParagraph();
- } else if(!command.compare("Indent")) {
+ } else if(EqualsASCII(command, "Indent")) {
GetEditor()->indent();
- } else if(!command.compare("Outdent")) {
+ } else if(EqualsASCII(command, "Outdent")) {
GetEditor()->outdent();
- } else if(!command.compare("DeleteBackward")) {
+ } else if(EqualsASCII(command, "DeleteBackward")) {
WebCore::AtomicString editor_command("BackwardDelete");
GetEditor()->command(editor_command).execute();
- } else if(!command.compare("DeleteForward")) {
+ } else if(EqualsASCII(command, "DeleteForward")) {
WebCore::AtomicString editor_command("ForwardDelete");
GetEditor()->command(editor_command).execute();
} else {
@@ -76,11 +78,11 @@ void WebTextInputImpl::DoCommand(const std::string& com) {
return;
}
-void WebTextInputImpl::SetMarkedText(const std::string& text,
+void WebTextInputImpl::SetMarkedText(const string16& text,
int32_t location,
int32_t length) {
WebCore::Editor* editor = GetEditor();
- WebCore::String str(text.c_str());
+ WebCore::String str = webkit_glue::String16ToString(text);
editor->confirmComposition(str);