diff options
author | yukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 01:44:39 +0000 |
---|---|---|
committer | yukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 01:44:39 +0000 |
commit | cf6cc2ee0f6a8267d5246f490421ac39b40f5b1c (patch) | |
tree | a8e3dae80b8783ab160c4337af91783359994ce4 /ui | |
parent | f67e18a5392f142f6d85e880c060ef5838f6bec2 (diff) | |
download | chromium_src-cf6cc2ee0f6a8267d5246f490421ac39b40f5b1c.zip chromium_src-cf6cc2ee0f6a8267d5246f490421ac39b40f5b1c.tar.gz chromium_src-cf6cc2ee0f6a8267d5246f490421ac39b40f5b1c.tar.bz2 |
Mark getter methods in ui::InputMethod as const
This CL marks following methods as "const-method"
as a preparation to fix issue 164964.
- ui::TextInputClient::GetCaretBounds
- ui::TextInputClient::GetCompositionCharacterBounds
- ui::TextInputClient::HasCompositionText
- ui::TextInputClient::GetTextRange
- ui::TextInputClient::GetCompositionTextRang
- ui::TextInputClient::GetSelectionRange
- ui::TextInputClient::GetTextFromRange
BUG=164964
TEST=none
Review URL: https://codereview.chromium.org/27812003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/ime/dummy_text_input_client.cc | 17 | ||||
-rw-r--r-- | ui/base/ime/dummy_text_input_client.h | 16 | ||||
-rw-r--r-- | ui/base/ime/input_method_ibus_unittest.cc | 17 | ||||
-rw-r--r-- | ui/base/ime/text_input_client.h | 16 | ||||
-rw-r--r-- | ui/base/ime/win/tsf_text_store_unittest.cc | 14 | ||||
-rw-r--r-- | ui/keyboard/keyboard_controller_unittest.cc | 19 | ||||
-rw-r--r-- | ui/views/controls/prefix_selector.cc | 14 | ||||
-rw-r--r-- | ui/views/controls/prefix_selector.h | 14 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 17 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.h | 14 | ||||
-rw-r--r-- | ui/views/ime/input_method_bridge.cc | 16 | ||||
-rw-r--r-- | ui/views/ime/input_method_bridge.h | 16 |
12 files changed, 100 insertions, 90 deletions
diff --git a/ui/base/ime/dummy_text_input_client.cc b/ui/base/ime/dummy_text_input_client.cc index c12daef..769cfd1 100644 --- a/ui/base/ime/dummy_text_input_client.cc +++ b/ui/base/ime/dummy_text_input_client.cc @@ -45,28 +45,29 @@ bool DummyTextInputClient::CanComposeInline() const { return false; } -gfx::Rect DummyTextInputClient::GetCaretBounds() { +gfx::Rect DummyTextInputClient::GetCaretBounds() const { return gfx::Rect(); } -bool DummyTextInputClient::GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) { +bool DummyTextInputClient::GetCompositionCharacterBounds( + uint32 index, + gfx::Rect* rect) const { return false; } -bool DummyTextInputClient::HasCompositionText() { +bool DummyTextInputClient::HasCompositionText() const { return false; } -bool DummyTextInputClient::GetTextRange(gfx::Range* range) { +bool DummyTextInputClient::GetTextRange(gfx::Range* range) const { return false; } -bool DummyTextInputClient::GetCompositionTextRange(gfx::Range* range) { +bool DummyTextInputClient::GetCompositionTextRange(gfx::Range* range) const { return false; } -bool DummyTextInputClient::GetSelectionRange(gfx::Range* range) { +bool DummyTextInputClient::GetSelectionRange(gfx::Range* range) const { return false; } @@ -79,7 +80,7 @@ bool DummyTextInputClient::DeleteRange(const gfx::Range& range) { } bool DummyTextInputClient::GetTextFromRange(const gfx::Range& range, - string16* text) { + string16* text) const { return false; } diff --git a/ui/base/ime/dummy_text_input_client.h b/ui/base/ime/dummy_text_input_client.h index 966502f..8937f17 100644 --- a/ui/base/ime/dummy_text_input_client.h +++ b/ui/base/ime/dummy_text_input_client.h @@ -23,20 +23,20 @@ class DummyTextInputClient : public TextInputClient { virtual void InsertText(const string16& text) OVERRIDE; virtual void InsertChar(char16 ch, int flags) OVERRIDE; virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; + virtual ui::TextInputType GetTextInputType() const OVERRIDE; virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() OVERRIDE; + virtual gfx::Rect GetCaretBounds() const OVERRIDE; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE; - virtual bool HasCompositionText() OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE; + gfx::Rect* rect) const OVERRIDE; + virtual bool HasCompositionText() const OVERRIDE; + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; virtual bool GetTextFromRange(const gfx::Range& range, - string16* text) OVERRIDE; + string16* text) const OVERRIDE; virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; diff --git a/ui/base/ime/input_method_ibus_unittest.cc b/ui/base/ime/input_method_ibus_unittest.cc index a9d4759..a43e90f 100644 --- a/ui/base/ime/input_method_ibus_unittest.cc +++ b/ui/base/ime/input_method_ibus_unittest.cc @@ -367,30 +367,33 @@ class InputMethodIBusTest : public internal::InputMethodDelegate, virtual bool CanComposeInline() const OVERRIDE { return can_compose_inline_; } - virtual gfx::Rect GetCaretBounds() OVERRIDE { + virtual gfx::Rect GetCaretBounds() const OVERRIDE { return caret_bounds_; } virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE { + gfx::Rect* rect) const OVERRIDE { return false; } - virtual bool HasCompositionText() OVERRIDE { + virtual bool HasCompositionText() const OVERRIDE { CompositionText empty; return composition_text_ != empty; } - virtual bool GetTextRange(gfx::Range* range) OVERRIDE { + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE { *range = text_range_; return true; } - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE { return false; } - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE { + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE { + return false; + } + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE { *range = selection_range_; return true; } virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE { return false; } virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; } - virtual bool GetTextFromRange(const gfx::Range& range, string16* text) OVERRIDE { + virtual bool GetTextFromRange(const gfx::Range& range, + string16* text) const OVERRIDE { *text = surrounding_text_.substr(range.GetMin(), range.length()); return true; } diff --git a/ui/base/ime/text_input_client.h b/ui/base/ime/text_input_client.h index 5eb4b5e..8158846 100644 --- a/ui/base/ime/text_input_client.h +++ b/ui/base/ime/text_input_client.h @@ -74,32 +74,33 @@ class UI_EXPORT TextInputClient { // Returns current caret (insertion point) bounds relative to the screen // coordinates. If there is selection, then the selection bounds will be // returned. - virtual gfx::Rect GetCaretBounds() = 0; + virtual gfx::Rect GetCaretBounds() const = 0; // Retrieves the composition character boundary rectangle relative to the // screen coordinates. The |index| is zero-based index of character position // in composition text. // Returns false if there is no composition text or |index| is out of range. // The |rect| is not touched in the case of failure. - virtual bool GetCompositionCharacterBounds(uint32 index, gfx::Rect* rect) = 0; + virtual bool GetCompositionCharacterBounds(uint32 index, + gfx::Rect* rect) const = 0; // Returns true if there is composition text. - virtual bool HasCompositionText() = 0; + virtual bool HasCompositionText() const = 0; // Document content operations ---------------------------------------------- // Retrieves the UTF-16 based character range containing accessibled text in // the View. It must cover the composition and selection range. // Returns false if the information cannot be retrieved right now. - virtual bool GetTextRange(gfx::Range* range) = 0; + virtual bool GetTextRange(gfx::Range* range) const = 0; // Retrieves the UTF-16 based character range of current composition text. // Returns false if the information cannot be retrieved right now. - virtual bool GetCompositionTextRange(gfx::Range* range) = 0; + virtual bool GetCompositionTextRange(gfx::Range* range) const = 0; // Retrieves the UTF-16 based character range of current selection. // Returns false if the information cannot be retrieved right now. - virtual bool GetSelectionRange(gfx::Range* range) = 0; + virtual bool GetSelectionRange(gfx::Range* range) const = 0; // Selects the given UTF-16 based character range. Current composition text // will be confirmed before selecting the range. @@ -120,7 +121,8 @@ class UI_EXPORT TextInputClient { // The result will be stored into |*text|. // Returns false if the operation is not supported or the specified range // is out of the text range returned by GetTextRange(). - virtual bool GetTextFromRange(const gfx::Range& range, string16* text) = 0; + virtual bool GetTextFromRange( + const gfx::Range& range, string16* text) const = 0; // Miscellaneous ------------------------------------------------------------ diff --git a/ui/base/ime/win/tsf_text_store_unittest.cc b/ui/base/ime/win/tsf_text_store_unittest.cc index 82268c9..f902428 100644 --- a/ui/base/ime/win/tsf_text_store_unittest.cc +++ b/ui/base/ime/win/tsf_text_store_unittest.cc @@ -35,15 +35,15 @@ class MockTextInputClient : public TextInputClient { MOCK_CONST_METHOD0(GetTextInputType, ui::TextInputType()); MOCK_CONST_METHOD0(GetTextInputMode, ui::TextInputMode()); MOCK_CONST_METHOD0(CanComposeInline, bool()); - MOCK_METHOD0(GetCaretBounds, gfx::Rect()); - MOCK_METHOD2(GetCompositionCharacterBounds, bool(uint32, gfx::Rect*)); - MOCK_METHOD0(HasCompositionText, bool()); - MOCK_METHOD1(GetTextRange, bool(gfx::Range*)); - MOCK_METHOD1(GetCompositionTextRange, bool(gfx::Range*)); - MOCK_METHOD1(GetSelectionRange, bool(gfx::Range*)); + MOCK_CONST_METHOD0(GetCaretBounds, gfx::Rect()); + MOCK_CONST_METHOD2(GetCompositionCharacterBounds, bool(uint32, gfx::Rect*)); + MOCK_CONST_METHOD0(HasCompositionText, bool()); + MOCK_CONST_METHOD1(GetTextRange, bool(gfx::Range*)); + MOCK_CONST_METHOD1(GetCompositionTextRange, bool(gfx::Range*)); + MOCK_CONST_METHOD1(GetSelectionRange, bool(gfx::Range*)); MOCK_METHOD1(SetSelectionRange, bool(const gfx::Range&)); MOCK_METHOD1(DeleteRange, bool(const gfx::Range&)); - MOCK_METHOD2(GetTextFromRange, bool(const gfx::Range&, string16*)); + MOCK_CONST_METHOD2(GetTextFromRange, bool(const gfx::Range&, string16*)); MOCK_METHOD0(OnInputMethodChanged, void()); MOCK_METHOD1(ChangeTextDirectionAndLayoutAlignment, bool(base::i18n::TextDirection)); diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc index 3650520..407cc6a 100644 --- a/ui/keyboard/keyboard_controller_unittest.cc +++ b/ui/keyboard/keyboard_controller_unittest.cc @@ -128,24 +128,27 @@ class TestTextInputClient : public ui::TextInputClient { return ui::TEXT_INPUT_MODE_DEFAULT; } virtual bool CanComposeInline() const OVERRIDE { return false; } - virtual gfx::Rect GetCaretBounds() OVERRIDE { return gfx::Rect(); } + virtual gfx::Rect GetCaretBounds() const OVERRIDE { return gfx::Rect(); } - virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE { + virtual bool GetCompositionCharacterBounds( + uint32 index, + gfx::Rect* rect) const OVERRIDE { return false; } - virtual bool HasCompositionText() OVERRIDE { return false; } - virtual bool GetTextRange(gfx::Range* range) OVERRIDE { return false; } - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE { + virtual bool HasCompositionText() const OVERRIDE { return false; } + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE { return false; } + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE { + return false; + } + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE { return false; } - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE { return false; } virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE { return false; } virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; } virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) OVERRIDE { + base::string16* text) const OVERRIDE { return false; } virtual void OnInputMethodChanged() OVERRIDE {} diff --git a/ui/views/controls/prefix_selector.cc b/ui/views/controls/prefix_selector.cc index 91659bc..1d646a9 100644 --- a/ui/views/controls/prefix_selector.cc +++ b/ui/views/controls/prefix_selector.cc @@ -71,7 +71,7 @@ bool PrefixSelector::CanComposeInline() const { return false; } -gfx::Rect PrefixSelector::GetCaretBounds() { +gfx::Rect PrefixSelector::GetCaretBounds() const { gfx::Rect rect(prefix_delegate_->GetVisibleBounds().origin(), gfx::Size()); // TextInputClient::GetCaretBounds is expected to return a value in screen // coordinates. @@ -80,28 +80,28 @@ gfx::Rect PrefixSelector::GetCaretBounds() { } bool PrefixSelector::GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) { + gfx::Rect* rect) const { // TextInputClient::GetCompositionCharacterBounds is expected to fill |rect| // in screen coordinates and GetCaretBounds returns screen coordinates. *rect = GetCaretBounds(); return false; } -bool PrefixSelector::HasCompositionText() { +bool PrefixSelector::HasCompositionText() const { return false; } -bool PrefixSelector::GetTextRange(gfx::Range* range) { +bool PrefixSelector::GetTextRange(gfx::Range* range) const { *range = gfx::Range(); return false; } -bool PrefixSelector::GetCompositionTextRange(gfx::Range* range) { +bool PrefixSelector::GetCompositionTextRange(gfx::Range* range) const { *range = gfx::Range(); return false; } -bool PrefixSelector::GetSelectionRange(gfx::Range* range) { +bool PrefixSelector::GetSelectionRange(gfx::Range* range) const { *range = gfx::Range(); return false; } @@ -115,7 +115,7 @@ bool PrefixSelector::DeleteRange(const gfx::Range& range) { } bool PrefixSelector::GetTextFromRange(const gfx::Range& range, - string16* text) { + string16* text) const { return false; } diff --git a/ui/views/controls/prefix_selector.h b/ui/views/controls/prefix_selector.h index 2c58008..0eaf534 100644 --- a/ui/views/controls/prefix_selector.h +++ b/ui/views/controls/prefix_selector.h @@ -35,17 +35,17 @@ class VIEWS_EXPORT PrefixSelector : public ui::TextInputClient { virtual ui::TextInputType GetTextInputType() const OVERRIDE; virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() OVERRIDE; + virtual gfx::Rect GetCaretBounds() const OVERRIDE; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE; - virtual bool HasCompositionText() OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE; + gfx::Rect* rect) const OVERRIDE; + virtual bool HasCompositionText() const OVERRIDE; + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; virtual bool GetTextFromRange(const gfx::Range& range, - string16* text) OVERRIDE; + string16* text) const OVERRIDE; virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index 69f9ef5..3632638 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -979,7 +979,7 @@ bool NativeTextfieldViews::CanComposeInline() const { return true; } -gfx::Rect NativeTextfieldViews::GetCaretBounds() { +gfx::Rect NativeTextfieldViews::GetCaretBounds() const { // TextInputClient::GetCaretBounds is expected to return a value in screen // coordinates. gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); @@ -987,8 +987,9 @@ gfx::Rect NativeTextfieldViews::GetCaretBounds() { return rect; } -bool NativeTextfieldViews::GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) { +bool NativeTextfieldViews::GetCompositionCharacterBounds( + uint32 index, + gfx::Rect* rect) const { DCHECK(rect); if (!HasCompositionText()) return false; @@ -1017,11 +1018,11 @@ bool NativeTextfieldViews::GetCompositionCharacterBounds(uint32 index, return true; } -bool NativeTextfieldViews::HasCompositionText() { +bool NativeTextfieldViews::HasCompositionText() const { return model_->HasCompositionText(); } -bool NativeTextfieldViews::GetTextRange(gfx::Range* range) { +bool NativeTextfieldViews::GetTextRange(gfx::Range* range) const { if (!ImeEditingAllowed()) return false; @@ -1029,7 +1030,7 @@ bool NativeTextfieldViews::GetTextRange(gfx::Range* range) { return true; } -bool NativeTextfieldViews::GetCompositionTextRange(gfx::Range* range) { +bool NativeTextfieldViews::GetCompositionTextRange(gfx::Range* range) const { if (!ImeEditingAllowed()) return false; @@ -1037,7 +1038,7 @@ bool NativeTextfieldViews::GetCompositionTextRange(gfx::Range* range) { return true; } -bool NativeTextfieldViews::GetSelectionRange(gfx::Range* range) { +bool NativeTextfieldViews::GetSelectionRange(gfx::Range* range) const { if (!ImeEditingAllowed()) return false; *range = GetSelectedRange(); @@ -1070,7 +1071,7 @@ bool NativeTextfieldViews::DeleteRange(const gfx::Range& range) { bool NativeTextfieldViews::GetTextFromRange( const gfx::Range& range, - string16* text) { + string16* text) const { if (!ImeEditingAllowed() || !range.IsValid()) return false; diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h index aa8b10d..a7e341c 100644 --- a/ui/views/controls/textfield/native_textfield_views.h +++ b/ui/views/controls/textfield/native_textfield_views.h @@ -183,17 +183,17 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, virtual ui::TextInputType GetTextInputType() const OVERRIDE; virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() OVERRIDE; + virtual gfx::Rect GetCaretBounds() const OVERRIDE; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE; - virtual bool HasCompositionText() OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE; + gfx::Rect* rect) const OVERRIDE; + virtual bool HasCompositionText() const OVERRIDE; + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; virtual bool GetTextFromRange(const gfx::Range& range, - string16* text) OVERRIDE; + string16* text) const OVERRIDE; virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc index f04f043..eed4ff1 100644 --- a/ui/views/ime/input_method_bridge.cc +++ b/ui/views/ime/input_method_bridge.cc @@ -152,7 +152,7 @@ bool InputMethodBridge::CanComposeInline() const { return client ? client->CanComposeInline() : true; } -gfx::Rect InputMethodBridge::GetCaretBounds() { +gfx::Rect InputMethodBridge::GetCaretBounds() const { TextInputClient* client = GetTextInputClient(); if (!client) return gfx::Rect(); @@ -161,7 +161,7 @@ gfx::Rect InputMethodBridge::GetCaretBounds() { } bool InputMethodBridge::GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) { + gfx::Rect* rect) const { DCHECK(rect); TextInputClient* client = GetTextInputClient(); if (!client) @@ -170,22 +170,22 @@ bool InputMethodBridge::GetCompositionCharacterBounds(uint32 index, return client->GetCompositionCharacterBounds(index, rect); } -bool InputMethodBridge::HasCompositionText() { +bool InputMethodBridge::HasCompositionText() const { TextInputClient* client = GetTextInputClient(); return client ? client->HasCompositionText() : false; } -bool InputMethodBridge::GetTextRange(gfx::Range* range) { +bool InputMethodBridge::GetTextRange(gfx::Range* range) const { TextInputClient* client = GetTextInputClient(); return client ? client->GetTextRange(range) : false; } -bool InputMethodBridge::GetCompositionTextRange(gfx::Range* range) { +bool InputMethodBridge::GetCompositionTextRange(gfx::Range* range) const { TextInputClient* client = GetTextInputClient(); return client ? client->GetCompositionTextRange(range) : false; } -bool InputMethodBridge::GetSelectionRange(gfx::Range* range) { +bool InputMethodBridge::GetSelectionRange(gfx::Range* range) const { TextInputClient* client = GetTextInputClient(); return client ? client->GetSelectionRange(range) : false; } @@ -200,8 +200,8 @@ bool InputMethodBridge::DeleteRange(const gfx::Range& range) { return client ? client->DeleteRange(range) : false; } -bool InputMethodBridge::GetTextFromRange( - const gfx::Range& range, string16* text) { +bool InputMethodBridge::GetTextFromRange(const gfx::Range& range, + string16* text) const { TextInputClient* client = GetTextInputClient(); return client ? client->GetTextFromRange(range, text) : false; } diff --git a/ui/views/ime/input_method_bridge.h b/ui/views/ime/input_method_bridge.h index c020ed9..73d596b 100644 --- a/ui/views/ime/input_method_bridge.h +++ b/ui/views/ime/input_method_bridge.h @@ -57,17 +57,17 @@ class InputMethodBridge : public InputMethodBase, virtual ui::TextInputType GetTextInputType() const OVERRIDE; virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() OVERRIDE; + virtual gfx::Rect GetCaretBounds() const OVERRIDE; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) OVERRIDE; - virtual bool HasCompositionText() OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) OVERRIDE; + gfx::Rect* rect) const OVERRIDE; + virtual bool HasCompositionText() const OVERRIDE; + virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; + virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; - virtual bool GetTextFromRange( - const gfx::Range& range, string16* text) OVERRIDE; + virtual bool GetTextFromRange(const gfx::Range& range, + string16* text) const OVERRIDE; virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; |