diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-14 08:01:05 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-14 08:01:05 +0000 |
commit | c55d4892c245bedab40fb51971658c824fcc1d6d (patch) | |
tree | 5dd2e37b0a2a3b539fd54dbc75156efd0955455d /views/ime | |
parent | 95c26346db7dcfc103b5a3d36be7b3d1a771875f (diff) | |
download | chromium_src-c55d4892c245bedab40fb51971658c824fcc1d6d.zip chromium_src-c55d4892c245bedab40fb51971658c824fcc1d6d.tar.gz chromium_src-c55d4892c245bedab40fb51971658c824fcc1d6d.tar.bz2 |
Move SetInitialFocus to Widget
Create InputMethod object per Top level NativeWidgetView
- use MockInputMethod when IBUS is not available for now.
Call OnNativeWidgetActivationChanged when activation changed.
Handle InputFocus change when activation changed. This is temp solution until we have WM in place.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7353009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/ime')
-rw-r--r-- | views/ime/mock_input_method.cc | 27 | ||||
-rw-r--r-- | views/ime/mock_input_method.h | 1 |
2 files changed, 21 insertions, 7 deletions
diff --git a/views/ime/mock_input_method.cc b/views/ime/mock_input_method.cc index 88645523..0d06d19 100644 --- a/views/ime/mock_input_method.cc +++ b/views/ime/mock_input_method.cc @@ -23,6 +23,18 @@ MockInputMethod::MockInputMethod() active_(true) { } +MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate) + : composition_changed_(false), + focus_changed_(false), + text_input_type_changed_(false), + caret_bounds_changed_(false), + cancel_composition_called_(false), + locale_("en-US"), + direction_(base::i18n::LEFT_TO_RIGHT), + active_(true) { + set_delegate(delegate); +} + MockInputMethod::~MockInputMethod() { } @@ -66,19 +78,20 @@ void MockInputMethod::DispatchKeyEvent(const KeyEvent& key) { } void MockInputMethod::OnTextInputTypeChanged(View* view) { - DCHECK(IsViewFocused(view)); - text_input_type_changed_ = true; + if (IsViewFocused(view)) + text_input_type_changed_ = true; } void MockInputMethod::OnCaretBoundsChanged(View* view) { - DCHECK(IsViewFocused(view)); - caret_bounds_changed_ = true; + if (IsViewFocused(view)) + caret_bounds_changed_ = true; } void MockInputMethod::CancelComposition(View* view) { - DCHECK(IsViewFocused(view)); - cancel_composition_called_ = true; - ClearResult(); + if (IsViewFocused(view)) { + cancel_composition_called_ = true; + ClearResult(); + } } std::string MockInputMethod::GetInputLocale() { diff --git a/views/ime/mock_input_method.h b/views/ime/mock_input_method.h index 3a1dffb..2691761 100644 --- a/views/ime/mock_input_method.h +++ b/views/ime/mock_input_method.h @@ -17,6 +17,7 @@ namespace views { class MockInputMethod : public InputMethodBase { public: MockInputMethod(); + explicit MockInputMethod(internal::InputMethodDelegate* delegate); virtual ~MockInputMethod(); // Overridden from InputMethod: |