summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 22:02:34 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 22:02:34 +0000
commit144199d5848b185b9e7f3f73374bde01eefeedb7 (patch)
tree8dfad57ce2d13502802c81d25e9a751905ac665e
parenta8f914871101974a4856248630c08454b7a7d294 (diff)
downloadchromium_src-144199d5848b185b9e7f3f73374bde01eefeedb7.zip
chromium_src-144199d5848b185b9e7f3f73374bde01eefeedb7.tar.gz
chromium_src-144199d5848b185b9e7f3f73374bde01eefeedb7.tar.bz2
revert r16006 due to msvc warning.
TBR=playmobil Review URL: http://codereview.chromium.org/113367 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16007 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/string_util.cc6
-rw-r--r--base/string_util.h4
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--webkit/glue/webtextinput.h7
-rw-r--r--webkit/glue/webtextinput_impl.cc24
-rw-r--r--webkit/glue/webtextinput_impl.h16
-rw-r--r--webkit/tools/test_shell/text_input_controller.cc7
7 files changed, 26 insertions, 40 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index ea4f91e..2e6f7b3 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -734,12 +734,6 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
-bool EqualsASCII(const string16& a, const StringPiece& b) {
- if (a.length() != b.length())
- return false;
- return std::equal(a.begin(), a.end(), b.begin());
-}
-
bool StartsWithASCII(const std::string& str,
const std::string& search,
bool case_sensitive) {
diff --git a/base/string_util.h b/base/string_util.h
index 84cb6e5..c32bef3 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -316,10 +316,6 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
const wchar_t* a_end,
const char* b);
-// Performs a case-sensitive string compare. The behavior is undefined if both
-// strings are not ASCII.
-bool EqualsASCII(const string16& a, const StringPiece& b);
-
// Returns true if str starts with search, or false otherwise.
bool StartsWithASCII(const std::string& str,
const std::string& search,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 210fd7f..1907c80 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2434,7 +2434,7 @@ void RenderView::OnInsertText(const string16& text) {
return;
WebTextInput* text_input = frame->GetTextInput();
if (text_input)
- text_input->InsertText(text);
+ text_input->InsertText(UTF16ToUTF8(text));
}
void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) {
diff --git a/webkit/glue/webtextinput.h b/webkit/glue/webtextinput.h
index 2e69874..60dfa7a 100644
--- a/webkit/glue/webtextinput.h
+++ b/webkit/glue/webtextinput.h
@@ -7,7 +7,6 @@
#include <string>
#include "base/basictypes.h"
-#include "base/string16.h"
class WebTextInput {
public:
@@ -15,13 +14,13 @@ class WebTextInput {
virtual ~WebTextInput() {}
// Inserts text to the associated frame.
- virtual void InsertText(const string16& text) = 0;
+ virtual void InsertText(const std::string& text) = 0;
// Executes the given editing command on the frame.
- virtual void DoCommand(const string16& command) = 0;
+ virtual void DoCommand(const std::string& command) = 0;
// Sets marked text region on the frame.
- virtual void SetMarkedText(const string16& text,
+ virtual void SetMarkedText(const std::string& text,
int32_t location, int32_t length) = 0;
// Clears the marked text region on the frame.
diff --git a/webkit/glue/webtextinput_impl.cc b/webkit/glue/webtextinput_impl.cc
index 84dcb9b..964a01e 100644
--- a/webkit/glue/webtextinput_impl.cc
+++ b/webkit/glue/webtextinput_impl.cc
@@ -14,9 +14,7 @@ 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"
@@ -36,18 +34,18 @@ WebCore::Editor* WebTextInputImpl::GetEditor() {
return web_frame_impl_->frame()->editor();
}
-void WebTextInputImpl::InsertText(const string16& text) {
- WebCore::String str = webkit_glue::String16ToString(text);
+void WebTextInputImpl::InsertText(const std::string& text) {
+ WebCore::String str(text.c_str());
GetEditor()->insertText(str, NULL);
}
-void WebTextInputImpl::DoCommand(const string16& com) {
+void WebTextInputImpl::DoCommand(const std::string& 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.
- string16 command = com;
+ std::string command = com;
// Make sure the first letter is upper case.
command.replace(0, 1, 1, toupper(command.at(0)));
@@ -58,16 +56,16 @@ void WebTextInputImpl::DoCommand(const string16& com) {
// Specially handling commands that Editor::execCommand does not directly
// support.
- if (EqualsASCII(command, "DeleteToEndOfParagraph")) {
+ if (!command.compare("DeleteToEndOfParagraph")) {
DeleteToEndOfParagraph();
- } else if(EqualsASCII(command, "Indent")) {
+ } else if(!command.compare("Indent")) {
GetEditor()->indent();
- } else if(EqualsASCII(command, "Outdent")) {
+ } else if(!command.compare("Outdent")) {
GetEditor()->outdent();
- } else if(EqualsASCII(command, "DeleteBackward")) {
+ } else if(!command.compare("DeleteBackward")) {
WebCore::AtomicString editor_command("BackwardDelete");
GetEditor()->command(editor_command).execute();
- } else if(EqualsASCII(command, "DeleteForward")) {
+ } else if(!command.compare("DeleteForward")) {
WebCore::AtomicString editor_command("ForwardDelete");
GetEditor()->command(editor_command).execute();
} else {
@@ -78,11 +76,11 @@ void WebTextInputImpl::DoCommand(const string16& com) {
return;
}
-void WebTextInputImpl::SetMarkedText(const string16& text,
+void WebTextInputImpl::SetMarkedText(const std::string& text,
int32_t location,
int32_t length) {
WebCore::Editor* editor = GetEditor();
- WebCore::String str = webkit_glue::String16ToString(text);
+ WebCore::String str(text.c_str());
editor->confirmComposition(str);
diff --git a/webkit/glue/webtextinput_impl.h b/webkit/glue/webtextinput_impl.h
index 8344f7e..c7a162b 100644
--- a/webkit/glue/webtextinput_impl.h
+++ b/webkit/glue/webtextinput_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 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.
//
@@ -6,8 +6,8 @@
// used by TextInputController in test_shell. It only facilitates layout tests
// and should not be used by renderers.
-#ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H_
-#define WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H_
+#ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__
+#define WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__
#include "webkit/glue/webtextinput.h"
@@ -19,9 +19,9 @@ class WebTextInputImpl : public WebTextInput {
virtual ~WebTextInputImpl();
// WebTextInput methods
- virtual void InsertText(const string16& text);
- virtual void DoCommand(const string16& command);
- virtual void SetMarkedText(const string16& text,
+ virtual void InsertText(const std::string& text);
+ virtual void DoCommand(const std::string& command);
+ virtual void SetMarkedText(const std::string& text,
int32_t location, int32_t length);
virtual void UnMarkText();
virtual bool HasMarkedText();
@@ -49,7 +49,7 @@ class WebTextInputImpl : public WebTextInput {
// Holding a non-owning pointer to the web frame we are associated with.
WebFrameImpl* web_frame_impl_;
- DISALLOW_COPY_AND_ASSIGN(WebTextInputImpl);
+ DISALLOW_EVIL_CONSTRUCTORS(WebTextInputImpl);
};
-#endif // #ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H_
+#endif // #ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__
diff --git a/webkit/tools/test_shell/text_input_controller.cc b/webkit/tools/test_shell/text_input_controller.cc
index a371881..121d9a9 100644
--- a/webkit/tools/test_shell/text_input_controller.cc
+++ b/webkit/tools/test_shell/text_input_controller.cc
@@ -4,7 +4,6 @@
#include "webkit/tools/test_shell/text_input_controller.h"
-#include "base/string_util.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/webframe.h"
#include "webkit/glue/webtextinput.h"
@@ -51,7 +50,7 @@ void TextInputController::insertText(
return;
if (args.size() >= 1 && args[0].isString()) {
- text_input->InsertText(UTF8ToUTF16(args[0].ToString()));
+ text_input->InsertText(args[0].ToString());
}
}
@@ -64,7 +63,7 @@ void TextInputController::doCommand(
return;
if (args.size() >= 1 && args[0].isString()) {
- text_input->DoCommand(UTF8ToUTF16(args[0].ToString()));
+ text_input->DoCommand(args[0].ToString());
}
}
@@ -78,7 +77,7 @@ void TextInputController::setMarkedText(
if (args.size() >= 3 && args[0].isString()
&& args[1].isNumber() && args[2].isNumber()) {
- text_input->SetMarkedText(UTF8ToUTF16(args[0].ToString()),
+ text_input->SetMarkedText(args[0].ToString(),
args[1].ToInt32(),
args[2].ToInt32());
}