summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 13:22:06 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 13:22:06 +0000
commit028cfbf4d662934306716f12b7142fcbbde6b84a (patch)
tree14d3539aeb5e09dc6bae83bb799268d277deb8cc
parent4b6af4f75e9ad65588f01d9e980a0cc427695d91 (diff)
downloadchromium_src-028cfbf4d662934306716f12b7142fcbbde6b84a.zip
chromium_src-028cfbf4d662934306716f12b7142fcbbde6b84a.tar.gz
chromium_src-028cfbf4d662934306716f12b7142fcbbde6b84a.tar.bz2
make reference parameters const.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1436 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/webtextinput.h8
-rw-r--r--webkit/glue/webtextinput_impl.cc15
-rw-r--r--webkit/glue/webtextinput_impl.h8
3 files changed, 16 insertions, 15 deletions
diff --git a/webkit/glue/webtextinput.h b/webkit/glue/webtextinput.h
index 3065a17..e259a4a 100644
--- a/webkit/glue/webtextinput.h
+++ b/webkit/glue/webtextinput.h
@@ -18,13 +18,13 @@ class WebTextInput {
virtual ~WebTextInput() {}
// Inserts text to the associated frame.
- virtual void InsertText(std::string& text) = 0;
+ virtual void InsertText(const std::string& text) = 0;
// Executes the given editing command on the frame.
- virtual void DoCommand(std::string& command) = 0;
+ virtual void DoCommand(const std::string& command) = 0;
// Sets marked text region on the frame.
- virtual void SetMarkedText(std::string& text,
+ virtual void SetMarkedText(const std::string& text,
int32_t location, int32_t length) = 0;
// Clears the marked text region on the frame.
@@ -53,7 +53,7 @@ class WebTextInput {
virtual void FirstRectForCharacterRange(int32_t location,
int32_t length) = 0;
virtual void CharacterIndexForPoint(double x, double y) = 0;
- virtual void MakeAttributedString(std::string& str) = 0;
+ virtual void MakeAttributedString(const std::string& str) = 0;
private:
DISALLOW_EVIL_CONSTRUCTORS(WebTextInput);
diff --git a/webkit/glue/webtextinput_impl.cc b/webkit/glue/webtextinput_impl.cc
index f5cdc50..cfbf91c5 100644
--- a/webkit/glue/webtextinput_impl.cc
+++ b/webkit/glue/webtextinput_impl.cc
@@ -32,17 +32,18 @@ WebCore::Editor* WebTextInputImpl::GetEditor() {
return web_frame_impl_->frame()->editor();
}
-void WebTextInputImpl::InsertText(std::string& text) {
+void WebTextInputImpl::InsertText(const std::string& text) {
WebCore::String str(text.c_str());
GetEditor()->insertText(str, NULL);
}
-void WebTextInputImpl::DoCommand(std::string& command) {
+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.
-
- if (command.length() <= 2)
- return;
+ std::string command = com;
// Make sure the first letter is upper case.
command.replace(0, 1, 1, toupper(command.at(0)));
@@ -73,7 +74,7 @@ void WebTextInputImpl::DoCommand(std::string& command) {
return;
}
-void WebTextInputImpl::SetMarkedText(std::string& text,
+void WebTextInputImpl::SetMarkedText(const std::string& text,
int32_t location,
int32_t length) {
WebCore::Editor* editor = GetEditor();
@@ -136,7 +137,7 @@ void WebTextInputImpl::ValidAttributesForMarkedText(std::string* attributes) {
attributes->assign("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment,NSTextInputReplacementRangeAttributeName");
}
-void WebTextInputImpl::MakeAttributedString(std::string& str) {
+void WebTextInputImpl::MakeAttributedString(const std::string& str) {
}
void WebTextInputImpl::DeleteToEndOfParagraph() {
diff --git a/webkit/glue/webtextinput_impl.h b/webkit/glue/webtextinput_impl.h
index ddfcdfd..587ebc9 100644
--- a/webkit/glue/webtextinput_impl.h
+++ b/webkit/glue/webtextinput_impl.h
@@ -20,9 +20,9 @@ class WebTextInputImpl : public WebTextInput {
virtual ~WebTextInputImpl();
// WebTextInput methods
- virtual void InsertText(std::string& text);
- virtual void DoCommand(std::string& command);
- virtual void SetMarkedText(std::string& 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();
@@ -39,7 +39,7 @@ class WebTextInputImpl : public WebTextInput {
virtual void FirstRectForCharacterRange(int32_t location,
int32_t length);
virtual void CharacterIndexForPoint(double x, double y);
- virtual void MakeAttributedString(std::string& str);
+ virtual void MakeAttributedString(const std::string& str);
private:
WebCore::Frame* GetFrame();