diff options
-rw-r--r-- | content/browser/renderer_host/native_web_keyboard_event_aura.cc | 43 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 235 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.h | 44 | ||||
-rw-r--r-- | content/public/browser/native_web_keyboard_event.h | 8 | ||||
-rw-r--r-- | ui/aura/aura.gyp | 8 | ||||
-rw-r--r-- | ui/aura/desktop.cc | 5 | ||||
-rw-r--r-- | ui/aura/desktop.h | 10 | ||||
-rw-r--r-- | ui/aura/desktop_host.h | 16 | ||||
-rw-r--r-- | ui/aura/desktop_host_ime_unittest.cc | 314 | ||||
-rw-r--r-- | ui/aura/desktop_host_linux.cc | 119 | ||||
-rw-r--r-- | ui/aura/desktop_host_win.cc | 25 | ||||
-rw-r--r-- | ui/aura/desktop_host_win.h | 18 | ||||
-rw-r--r-- | ui/aura/event.h | 1 | ||||
-rw-r--r-- | ui/base/keycodes/keyboard_code_conversion.cc | 4 | ||||
-rw-r--r-- | ui/base/keycodes/keyboard_code_conversion_x.h | 1 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 11 |
16 files changed, 67 insertions, 795 deletions
diff --git a/content/browser/renderer_host/native_web_keyboard_event_aura.cc b/content/browser/renderer_host/native_web_keyboard_event_aura.cc index 4c3b172..fa3d0d6 100644 --- a/content/browser/renderer_host/native_web_keyboard_event_aura.cc +++ b/content/browser/renderer_host/native_web_keyboard_event_aura.cc @@ -4,24 +4,10 @@ #include "content/public/browser/native_web_keyboard_event.h" -#include "base/logging.h" #include "content/browser/renderer_host/web_input_event_aura.h" -#include "ui/base/events.h" using WebKit::WebKeyboardEvent; -namespace { - -int EventFlagsToWebInputEventModifiers(int flags) { - return - (flags & ui::EF_SHIFT_DOWN ? WebKit::WebInputEvent::ShiftKey : 0) | - (flags & ui::EF_CONTROL_DOWN ? WebKit::WebInputEvent::ControlKey : 0) | - (flags & ui::EF_CAPS_LOCK_DOWN ? WebKit::WebInputEvent::CapsLockOn : 0) | - (flags & ui::EF_ALT_DOWN ? WebKit::WebInputEvent::AltKey : 0); -} - -} // namespace - NativeWebKeyboardEvent::NativeWebKeyboardEvent() : os_event(NULL), skip_in_browser(false) { @@ -41,35 +27,6 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent( skip_in_browser(other.skip_in_browser) { } -NativeWebKeyboardEvent::NativeWebKeyboardEvent( - ui::EventType key_event_type, - bool is_char, - wchar_t character, - int state, - double time_stamp_seconds) - : os_event(NULL), - skip_in_browser(true /* already handled by the input method */) { - switch (key_event_type) { - case ui::ET_KEY_PRESSED: - type = is_char ? WebKit::WebInputEvent::Char : - WebKit::WebInputEvent::RawKeyDown; - break; - case ui::ET_KEY_RELEASED: - type = WebKit::WebInputEvent::KeyUp; - break; - default: - NOTREACHED(); - } - - modifiers = EventFlagsToWebInputEventModifiers(state); - timeStampSeconds = time_stamp_seconds; - windowsKeyCode = character; - nativeKeyCode = character; - text[0] = character; - unmodifiedText[0] = character; - isSystemKey = (state & ui::EF_ALT_DOWN) != 0; -} - NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( const NativeWebKeyboardEvent& other) { WebKeyboardEvent::operator=(other); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 160ac61..9978862 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -10,7 +10,6 @@ #include "content/browser/renderer_host/web_input_event_aura.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/common/gpu/gpu_messages.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "ui/aura/client/aura_constants.h" @@ -20,7 +19,6 @@ #include "ui/aura/window.h" #include "ui/aura/window_types.h" #include "ui/base/hit_test.h" -#include "ui/base/ime/input_method.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/canvas.h" #include "ui/gfx/compositor/layer.h" @@ -96,8 +94,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) is_fullscreen_(false), popup_parent_host_view_(NULL), is_loading_(false), - text_input_type_(ui::TEXT_INPUT_TYPE_NONE), - has_composition_text_(false), #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) current_surface_(gfx::kNullPluginWindow), #endif @@ -238,27 +234,13 @@ void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { void RenderWidgetHostViewAura::TextInputStateChanged( ui::TextInputType type, bool can_compose_inline) { - // TODO(kinaba): currently, can_compose_inline is ignored and always treated - // as true. We need to support "can_compose_inline=false" for PPAPI plugins - // that may want to avoid drawing composition-text by themselves and pass - // the responsibility to the browser. - if (text_input_type_ != type) { - text_input_type_ = type; - GetInputMethod()->OnTextInputTypeChanged(this); - } + // http://crbug.com/102569 + NOTIMPLEMENTED(); } void RenderWidgetHostViewAura::ImeCancelComposition() { - GetInputMethod()->CancelComposition(this); - has_composition_text_ = false; -} - -void RenderWidgetHostViewAura::FinishImeCompositionSession() { - if (!has_composition_text_) - return; - if (host_) - host_->ImeConfirmComposition(); - ImeCancelComposition(); + // http://crbug.com/102569 + NOTIMPLEMENTED(); } void RenderWidgetHostViewAura::DidUpdateBackingStore( @@ -299,18 +281,6 @@ void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { } } -void RenderWidgetHostViewAura::SelectionBoundsChanged( - const gfx::Rect& start_rect, - const gfx::Rect& end_rect) { - if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) - return; - - selection_start_rect_ = start_rect; - selection_end_rect_ = end_rect; - - GetInputMethod()->OnCaretBoundsChanged(this); -} - BackingStore* RenderWidgetHostViewAura::AllocBackingStore( const gfx::Size& size) { return new BackingStoreSkia(host_, size); @@ -485,164 +455,6 @@ void RenderWidgetHostViewAura::UnlockMouse() { } //////////////////////////////////////////////////////////////////////////////// -// RenderWidgetHostViewAura, ui::TextInputClient implementation: -void RenderWidgetHostViewAura::SetCompositionText( - const ui::CompositionText& composition) { - if (!host_) - return; - - // ui::CompositionUnderline should be identical to - // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. - COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == - sizeof(WebKit::WebCompositionUnderline), - ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); - - // TODO(suzhe): convert both renderer_host and renderer to use - // ui::CompositionText. - const std::vector<WebKit::WebCompositionUnderline>& underlines = - reinterpret_cast<const std::vector<WebKit::WebCompositionUnderline>&>( - composition.underlines); - - // TODO(suzhe): due to a bug of webkit, we can't use selection range with - // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 - host_->ImeSetComposition(composition.text, underlines, - composition.selection.end(), - composition.selection.end()); - - has_composition_text_ = !composition.text.empty(); -} - -void RenderWidgetHostViewAura::ConfirmCompositionText() { - if (host_ && has_composition_text_) - host_->ImeConfirmComposition(); - has_composition_text_ = false; -} - -void RenderWidgetHostViewAura::ClearCompositionText() { - if (host_ && has_composition_text_) - host_->ImeCancelComposition(); - has_composition_text_ = false; -} - -void RenderWidgetHostViewAura::InsertText(const string16& text) { - DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); - if (host_) - host_->ImeConfirmComposition(text); - has_composition_text_ = false; -} - -void RenderWidgetHostViewAura::InsertChar(char16 ch, int flags) { - if (host_) { - // Send a WebKit::WebInputEvent::Char event to |host_|. - NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED, - true /* is_char */, - ch, - flags, - base::Time::Now().ToDoubleT()); - host_->ForwardKeyboardEvent(webkit_event); - } -} - -ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { - return text_input_type_; -} - -gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { - const gfx::Rect rect = selection_start_rect_.Union(selection_end_rect_); - gfx::Point origin = rect.origin(); - gfx::Point end = gfx::Point(rect.right(), rect.bottom()); - - aura::Desktop* desktop = aura::Desktop::GetInstance(); - aura::Window::ConvertPointToWindow(window_, desktop, &origin); - aura::Window::ConvertPointToWindow(window_, desktop, &end); - // TODO(yusukes): Unlike Chrome OS, |desktop| origin might not be the same as - // the system screen origin on Windows and Linux. Probably we should - // (implement and) use something like ConvertPointToScreen(). - - return gfx::Rect(origin.x(), - origin.y(), - end.x() - origin.x(), - end.y() - origin.y()); -} - -bool RenderWidgetHostViewAura::HasCompositionText() { - return has_composition_text_; -} - -bool RenderWidgetHostViewAura::GetTextRange(ui::Range* range) { - range->set_start(selection_text_offset_); - range->set_end(selection_text_offset_ + selection_text_.length()); - return true; -} - -bool RenderWidgetHostViewAura::GetCompositionTextRange(ui::Range* range) { - // TODO(suzhe): implement this method when fixing http://crbug.com/55130. - NOTIMPLEMENTED(); - return false; -} - -bool RenderWidgetHostViewAura::GetSelectionRange(ui::Range* range) { - range->set_start(selection_range_.start()); - range->set_end(selection_range_.end()); - return true; -} - -bool RenderWidgetHostViewAura::SetSelectionRange(const ui::Range& range) { - // TODO(suzhe): implement this method when fixing http://crbug.com/55130. - NOTIMPLEMENTED(); - return false; -} - -bool RenderWidgetHostViewAura::DeleteRange(const ui::Range& range) { - // TODO(suzhe): implement this method when fixing http://crbug.com/55130. - NOTIMPLEMENTED(); - return false; -} - -bool RenderWidgetHostViewAura::GetTextFromRange( - const ui::Range& range, - string16* text) { - ui::Range selection_text_range(selection_text_offset_, - selection_text_offset_ + selection_text_.length()); - - if (!selection_text_range.Contains(range)) { - text->clear(); - return false; - } - if (selection_text_range.EqualsIgnoringDirection(range)) { - // Avoid calling substr whose performance is low. - *text = selection_text_; - } else { - *text = selection_text_.substr( - range.GetMin() - selection_text_offset_, - range.length()); - } - return true; -} - -void RenderWidgetHostViewAura::OnInputMethodChanged() { - if (!host_) - return; - - host_->SetInputMethodActive(GetInputMethod()->IsActive()); - - // TODO(suzhe): implement the newly added “locale” property of HTML DOM - // TextEvent. -} - -bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) { - if (!host_) - return false; - host_->UpdateTextDirection( - direction == base::i18n::RIGHT_TO_LEFT ? - WebKit::WebTextDirectionRightToLeft : - WebKit::WebTextDirectionLeftToRight); - host_->NotifyTextDirection(); - return true; -} - -//////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewAura, aura::WindowDelegate implementation: gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { @@ -657,22 +469,10 @@ void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, void RenderWidgetHostViewAura::OnFocus() { host_->GotFocus(); - - ui::InputMethod* input_method = GetInputMethod(); - // Ask the system-wide IME to send all TextInputClient messages to |this| - // object. - input_method->SetFocusedTextInputClient(this); - - host_->SetInputMethodActive(input_method->IsActive()); } void RenderWidgetHostViewAura::OnBlur() { host_->Blur(); - - ui::InputMethod* input_method = GetInputMethod(); - if (input_method->GetTextInputClient() == this) - input_method->SetFocusedTextInputClient(NULL); - host_->SetInputMethodActive(false); } bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { @@ -680,23 +480,8 @@ bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { host_->Shutdown(); } else { - // We don't have to communicate with an input method here. It has already - // been done by ui/aura/desktop_host_<platform>.cc. -#if defined(USE_X11) - if (!event->native_event()) { - // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event. - NativeWebKeyboardEvent webkit_event(event->type(), - false /* is_char */, - event->GetCharacter(), - event->flags(), - base::Time::Now().ToDoubleT()); - host_->ForwardKeyboardEvent(webkit_event); - } else -#endif - { - NativeWebKeyboardEvent webkit_event(event); - host_->ForwardKeyboardEvent(webkit_event); - } + NativeWebKeyboardEvent webkit_event(event); + host_->ForwardKeyboardEvent(webkit_event); } return true; } @@ -719,9 +504,6 @@ bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_PRESSED: window_->SetCapture(); - // Confirm existing composition text on mouse click events, to make sure - // the input caret won't be moved with an ongoing composition text. - FinishImeCompositionSession(); break; case ui::ET_MOUSE_RELEASED: window_->ReleaseCapture(); @@ -837,8 +619,3 @@ void RenderWidgetHostView::GetDefaultScreenInfo( results->depth = 24; results->depthPerComponent = 8; } - -ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() { - aura::Desktop* desktop = aura::Desktop::GetInstance(); - return desktop->GetInputMethod(); -} diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 52d758c..2cf607d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -11,7 +11,6 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/content_export.h" #include "ui/aura/window_delegate.h" -#include "ui/base/ime/text_input_client.h" #include "ui/gfx/compositor/compositor_observer.h" #include "webkit/glue/webcursor.h" @@ -20,10 +19,6 @@ #include "base/memory/ref_counted.h" #endif -namespace ui { -class InputMethod; -} - namespace WebKit { class WebTouchEvent; } @@ -37,7 +32,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) public ui::CompositorObserver, #endif - public ui::TextInputClient, public aura::WindowDelegate { public: explicit RenderWidgetHostViewAura(RenderWidgetHost* host); @@ -80,8 +74,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura int error_code) OVERRIDE; virtual void Destroy() OVERRIDE; virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; - virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, - const gfx::Rect& end_rect) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( @@ -111,27 +103,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura virtual bool LockMouse() OVERRIDE; virtual void UnlockMouse() OVERRIDE; - // Overridden from ui::TextInputClient: - virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE; - virtual void ConfirmCompositionText() OVERRIDE; - virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const string16& text) OVERRIDE; - virtual void InsertChar(char16 ch, int flags) OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() OVERRIDE; - virtual bool HasCompositionText() OVERRIDE; - virtual bool GetTextRange(ui::Range* range) OVERRIDE; - virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE; - virtual bool GetSelectionRange(ui::Range* range) OVERRIDE; - virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE; - virtual bool DeleteRange(const ui::Range& range) OVERRIDE; - virtual bool GetTextFromRange(const ui::Range& range, - string16* text) OVERRIDE; - virtual void OnInputMethodChanged() OVERRIDE; - virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE; - // Overridden from aura::WindowDelegate: virtual gfx::Size GetMinimumSize() const OVERRIDE; virtual void OnBoundsChanged(const gfx::Rect& old_bounds, @@ -161,11 +132,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura void UpdateCursorIfOverSelf(); void UpdateExternalTexture(); - ui::InputMethod* GetInputMethod(); - - // Confirm existing composition text in the webpage and ask the input method - // to cancel its ongoing composition session. - void FinishImeCompositionSession(); // The model object. RenderWidgetHost* host_; @@ -189,16 +155,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // removed from the list on an ET_TOUCH_RELEASED event. WebKit::WebTouchEvent touch_event_; - // The current text input type. - ui::TextInputType text_input_type_; - - // Rectangles before and after the selection. - gfx::Rect selection_start_rect_; - gfx::Rect selection_end_rect_; - - // Indicates if there is onging composition text. - bool has_composition_text_; - // Current tooltip text. string16 tooltip_; diff --git a/content/public/browser/native_web_keyboard_event.h b/content/public/browser/native_web_keyboard_event.h index e2fc5cb..35cc052 100644 --- a/content/public/browser/native_web_keyboard_event.h +++ b/content/public/browser/native_web_keyboard_event.h @@ -11,7 +11,6 @@ #include "build/build_config.h" #include "content/common/content_export.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" -#include "ui/base/events.h" #include "ui/gfx/native_widget_types.h" // Owns a platform specific event; used to pass own and pass event through @@ -30,13 +29,6 @@ struct CONTENT_EXPORT NativeWebKeyboardEvent : int state, double time_stamp_seconds); #endif -#if defined(USE_AURA) - NativeWebKeyboardEvent(ui::EventType type, - bool is_char, - wchar_t character, - int state, - double time_stamp_seconds); -#endif NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event); ~NativeWebKeyboardEvent(); diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index c87ce3e..6d98b42 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -53,13 +53,6 @@ 'window_observer.h', 'window_types.h', ], - 'conditions': [ - ['use_ibus==1', { - 'dependencies': [ - '../../build/linux/system.gyp:ibus', - ], - }], - ], }, { 'target_name': 'test_support_aura', @@ -138,7 +131,6 @@ 'test/run_all_unittests.cc', 'test/test_suite.cc', 'test/test_suite.h', - 'desktop_host_ime_unittest.cc', 'desktop_unittest.cc', 'event_filter_unittest.cc', 'window_unittest.cc', diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc index 4fae6fb..7bf25d3 100644 --- a/ui/aura/desktop.cc +++ b/ui/aura/desktop.cc @@ -24,7 +24,6 @@ #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" #include "ui/base/hit_test.h" -#include "ui/base/ime/input_method.h" #include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/layer_animator.h" @@ -609,8 +608,4 @@ gfx::Rect Desktop::GetInitialHostWindowBounds() const { return bounds; } -ui::InputMethod* Desktop::GetInputMethod() { - return host_->GetInputMethod(); -} - } // namespace aura diff --git a/ui/aura/desktop.h b/ui/aura/desktop.h index b0ff82a..d76e43e 100644 --- a/ui/aura/desktop.h +++ b/ui/aura/desktop.h @@ -26,17 +26,12 @@ class Size; } namespace ui { -class InputMethod; class LayerAnimationSequence; class Transform; } namespace aura { -namespace test { -class DesktopHostIMETest; -} // namespace test - class DesktopHost; class DesktopObserver; class KeyEvent; @@ -150,9 +145,6 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate, // Overridden from Window: virtual void SetTransform(const ui::Transform& transform) OVERRIDE; - // Gets the input method for the desktop. - ui::InputMethod* GetInputMethod(); - #if !defined(NDEBUG) // Toggles the host's full screen state. void ToggleFullScreen(); @@ -162,8 +154,6 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate, virtual void ScheduleDraw(); private: - friend class aura::test::DesktopHostIMETest; // need to access |host_|. - Desktop(); virtual ~Desktop(); diff --git a/ui/aura/desktop_host.h b/ui/aura/desktop_host.h index b74c8b4..f72fc52 100644 --- a/ui/aura/desktop_host.h +++ b/ui/aura/desktop_host.h @@ -8,13 +8,8 @@ #include "base/message_loop.h" #include "ui/aura/cursor.h" -#include "ui/base/ime/input_method_delegate.h" #include "ui/gfx/native_widget_types.h" -namespace ui { -class InputMethod; -} - namespace gfx { class Point; class Rect; @@ -27,8 +22,7 @@ class Desktop; // DesktopHost bridges between a native window and the embedded Desktop. It // provides the accelerated widget and maps events from the native os to aura. -class DesktopHost : public MessageLoop::Dispatcher, - public ui::internal::InputMethodDelegate { +class DesktopHost : public MessageLoop::Dispatcher { public: virtual ~DesktopHost() {} @@ -70,14 +64,6 @@ class DesktopHost : public MessageLoop::Dispatcher, // Posts |native_event| to the platform's event queue. virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; - - // Sets the input method for the desktop. DesktopHost owns the input method. - // The function is only for unit tests. - virtual void SetInputMethod(ui::InputMethod* input_method) = 0; - - // Gets the input method for the desktop. The caller does not own the returned - // value. - virtual ui::InputMethod* GetInputMethod() const = 0; }; } // namespace aura diff --git a/ui/aura/desktop_host_ime_unittest.cc b/ui/aura/desktop_host_ime_unittest.cc deleted file mode 100644 index 61a0b87..0000000 --- a/ui/aura/desktop_host_ime_unittest.cc +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (c) 2011 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. - -#include "ui/aura/desktop_host.h" - -#if defined(USE_X11) -#include <X11/keysym.h> -#include <X11/Xlib.h> -#undef Bool -#undef None -#undef Status -#endif - -#include <cstring> - -#include "base/message_loop.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/aura/desktop.h" -#include "ui/aura/event.h" -#include "ui/aura/test/aura_test_base.h" -#include "ui/aura/test/test_window_delegate.h" -#include "ui/aura/test/test_windows.h" -#include "ui/base/ime/input_method_delegate.h" -#include "ui/base/ime/mock_input_method.h" -#include "ui/base/ime/text_input_client.h" -#if defined(USE_X11) -#include "ui/base/x/x11_util.h" -#endif -#include "ui/gfx/rect.h" - -#if !defined(USE_X11) -#define PostKeyEvent DISABLED_PostKeyEvent -#define PostKeyEventNoDummyDelegate DISABLED_PostKeyEventNoDummyDelegate -#define PostKeyEventWithInputMethodNoDummyDelegate \ -DISABLED_PostKeyEventWithInputMethodNoDummyDelegate -#endif - -namespace aura { -namespace test { - -namespace { - -// A dummy WindowDelegate implementation which quits a current message loop -// when it receives a key event. -class DummyWindowDelegate : public TestWindowDelegate { - public: - virtual ~DummyWindowDelegate() { - } - virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE { - MessageLoopForUI::current()->Quit(); - return true; - } -}; - -// A dummy InputMethodDelegate implementation which quits a current message loop -// when it receives a native or fabricated key event. -class DummyInputMethodDelegate : public ui::internal::InputMethodDelegate { - public: - DummyInputMethodDelegate() { - ResetFlags(); - } - virtual ~DummyInputMethodDelegate() {} - - virtual void DispatchKeyEventPostIME( - const base::NativeEvent& native_key_event) OVERRIDE { - has_key_event_ = true; - MessageLoopForUI::current()->Quit(); - } - virtual void DispatchFabricatedKeyEventPostIME( - ui::EventType type, ui::KeyboardCode key_code, int flags) OVERRIDE { - has_fabricated_key_event_ = true; - MessageLoopForUI::current()->Quit(); - } - - void ResetFlags() { - has_key_event_ = has_fabricated_key_event_ = false; - } - - bool has_key_event_; - bool has_fabricated_key_event_; -}; - -// A dummy TextInputClient implementation which remembers if InsertChar function -// is called. -class DummyTextInputClient : public ui::TextInputClient { - public: - DummyTextInputClient() { - ResetFlag(); - } - virtual ~DummyTextInputClient() { - } - - virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE {} - virtual void ConfirmCompositionText() OVERRIDE {} - virtual void ClearCompositionText() OVERRIDE {} - virtual void InsertText(const string16& text) OVERRIDE {} - virtual void InsertChar(char16 ch, int flags) OVERRIDE { - has_char_event_ = true; - } - virtual ui::TextInputType GetTextInputType() const OVERRIDE { - return ui::TEXT_INPUT_TYPE_NONE; - } - virtual gfx::Rect GetCaretBounds() OVERRIDE { - return gfx::Rect(); - } - virtual bool HasCompositionText() OVERRIDE { - return false; - } - virtual bool GetTextRange(ui::Range* range) OVERRIDE { - return false; - } - virtual bool GetCompositionTextRange(ui::Range* range) OVERRIDE { - return false; - } - virtual bool GetSelectionRange(ui::Range* range) OVERRIDE { - return false; - } - virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE { - return false; - } - virtual bool DeleteRange(const ui::Range& range) OVERRIDE { - return false; - } - virtual bool GetTextFromRange( - const ui::Range& range, string16* text) OVERRIDE { - return false; - } - virtual void OnInputMethodChanged() OVERRIDE { - } - virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE { - return false; - } - - void ResetFlag() { - has_char_event_ = false; - } - - bool has_char_event_; -}; - -// Returns a native key press or key release event. -// TODO(yusukes): Add function parameters like |key_name| and |modifiers| so -// that it could generate an event other than XK_space. -base::NativeEvent SynthesizeKeyEvent(bool is_press) { - base::NativeEvent event = base::NativeEvent(); - -#if defined(USE_X11) - event = new XEvent; - std::memset(event, 0, sizeof(XEvent)); - - Display* display = ui::GetXDisplay(); - ::Window focused; - int dummy; - XGetInputFocus(display, &focused, &dummy); - - XKeyEvent* key_event = &event->xkey; - key_event->display = display; - key_event->keycode = XKeysymToKeycode(display, XK_space); - key_event->root = ui::GetX11RootWindow(); - key_event->same_screen = True; - key_event->send_event = False; - key_event->state = 0; - key_event->subwindow = 0L; // None; - key_event->time = CurrentTime; - key_event->type = is_press ? KeyPress : KeyRelease; - key_event->window = focused; - key_event->x = key_event->x_root = key_event->y = key_event->y_root = 1; -#else - // TODO(yusukes): Support Windows. - NOTIMPLEMENTED(); -#endif - - return event; -} - -// Deletes a native event generated by SynthesizeKeyEvent() above. -void Delete(base::NativeEvent event) { -#if defined(USE_X11) - delete event; -#else - // TODO(yusukes): Support Windows. - NOTIMPLEMENTED(); -#endif -} - -// Enters a nested message loop. -void RunMessageLoop() { - MessageLoop* loop = MessageLoop::current(); - const bool did_allow_task_nesting = loop->NestableTasksAllowed(); - loop->SetNestableTasksAllowed(true); - aura::Desktop::GetInstance()->Run(); - loop->SetNestableTasksAllowed(did_allow_task_nesting); -} - -} // namespace - -class DesktopHostIMETest : public AuraTestBase { - protected: - DesktopHostIMETest() : desktop_(Desktop::GetInstance()), - host_(desktop_->host_.get()), - input_method_(new ui::MockInputMethod(host_)), - window_(CreateTestWindowWithDelegate( - &window_delegate_, -1, - gfx::Rect(2, 3, 4, 5), NULL)) { - } - - virtual void SetUp() OVERRIDE { - input_method_->Init(true); - input_method_->SetFocusedTextInputClient(&text_input_client_); - host_->SetInputMethod(input_method_); // pass ownership - AuraTestBase::SetUp(); - } - - Desktop* desktop_; - DesktopHost* host_; - ui::MockInputMethod* input_method_; - - DummyInputMethodDelegate input_method_delegate_; - DummyTextInputClient text_input_client_; - - DummyWindowDelegate window_delegate_; - scoped_ptr<aura::Window> window_; -}; - -// Test if DesktopHost correctly passes a key press/release event to an IME. -TEST_F(DesktopHostIMETest, PostKeyEvent) { - input_method_->SetDelegate(&input_method_delegate_); - - // Press space. The press event should directly go to |input_method_delegate_| - // and then, a 'Char' event should also be generated and passed to - // |text_input_client_|. - base::NativeEvent event = SynthesizeKeyEvent(true /* press */); - host_->PostNativeEvent(event); - // Enter a new message loop and wait for an InputMethodDelegate function to - // be called. - RunMessageLoop(); - EXPECT_TRUE(input_method_delegate_.has_key_event_); - EXPECT_FALSE(input_method_delegate_.has_fabricated_key_event_); - EXPECT_TRUE(text_input_client_.has_char_event_); - input_method_delegate_.ResetFlags(); - text_input_client_.ResetFlag(); - Delete(event); - - // Release space. A Char event should NOT be generated. - event = SynthesizeKeyEvent(false); - host_->PostNativeEvent(event); - RunMessageLoop(); - EXPECT_TRUE(input_method_delegate_.has_key_event_); - EXPECT_FALSE(input_method_delegate_.has_fabricated_key_event_); - EXPECT_FALSE(text_input_client_.has_char_event_); - input_method_delegate_.ResetFlags(); - text_input_client_.ResetFlag(); - Delete(event); -} - -// Do the same as above, but use the |host_| itself as ui::InputMethodDelegate -// to see if DesktopHost::DispatchKeyEventPostIME() function correctly passes -// a key event to the |desktop_|. -TEST_F(DesktopHostIMETest, PostKeyEventNoDummyDelegate) { - input_method_->SetDelegate(host_); - // Call SetActiveWindow here so DummyWindowDelegate could receive a key event. - desktop_->SetActiveWindow(window_.get(), NULL); - - // Press space. DummyWindowDelegate will quit the loop. A Char event should - // be generated. - base::NativeEvent event = SynthesizeKeyEvent(true /* press */); - host_->PostNativeEvent(event); - RunMessageLoop(); - EXPECT_TRUE(text_input_client_.has_char_event_); - text_input_client_.ResetFlag(); - Delete(event); - - // Release space. - event = SynthesizeKeyEvent(false); - host_->PostNativeEvent(event); - RunMessageLoop(); - EXPECT_FALSE(text_input_client_.has_char_event_); - text_input_client_.ResetFlag(); - Delete(event); -} - -// Do the same as above, but this time, |input_method_| consumes the key press -// event. Checks if DesktopHost::DispatchFabricatedKeyEventPostIME() function -// called by |input_method_| correctly passes a VK_PROCESS key event to the -// |desktop_|. -TEST_F(DesktopHostIMETest, PostKeyEventWithInputMethodNoDummyDelegate) { - input_method_->SetDelegate(host_); - input_method_->ConsumeNextKey(); - desktop_->SetActiveWindow(window_.get(), NULL); - - // Press space. The press event will be consumed by the mock IME and will not - // be passed to the delegate. Instead, a fabricated key event (VK_PROCESSKEY) - // will be passed to it. Char event should not be generated this time. - base::NativeEvent event = SynthesizeKeyEvent(true); - host_->PostNativeEvent(event); - RunMessageLoop(); - EXPECT_FALSE(text_input_client_.has_char_event_); - text_input_client_.ResetFlag(); - Delete(event); - - // Release space. A Char event should not be generated. - event = SynthesizeKeyEvent(false); - host_->PostNativeEvent(event); - RunMessageLoop(); - EXPECT_FALSE(text_input_client_.has_char_event_); - text_input_client_.ResetFlag(); - Delete(event); -} - -} // namespace test -} // namespace aura diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc index 23b4907..5743936 100644 --- a/ui/aura/desktop_host_linux.cc +++ b/ui/aura/desktop_host_linux.cc @@ -12,8 +12,6 @@ #include <algorithm> -#include "base/event_types.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_pump_x.h" #include "ui/aura/cursor.h" @@ -28,12 +26,6 @@ #include <X11/extensions/XInput2.h> #include <X11/Xlib.h> -#if defined(HAVE_IBUS) -#include "ui/base/ime/input_method_ibus.h" -#else -#include "ui/base/ime/mock_input_method.h" -#endif - using std::max; using std::min; @@ -238,6 +230,47 @@ int CoalescePendingXIMotionEvents(const XEvent* xev, XEvent* last_event) { return num_coalesed; } +// We emulate Windows' WM_KEYDOWN and WM_CHAR messages. WM_CHAR events are only +// generated for certain keys; see +// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646268.aspx. +bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) { + if ((keycode >= ui::VKEY_0 && keycode <= ui::VKEY_9) || + (keycode >= ui::VKEY_A && keycode <= ui::VKEY_Z) || + (keycode >= ui::VKEY_NUMPAD0 && keycode <= ui::VKEY_NUMPAD9)) { + return true; + } + + switch (keycode) { + case ui::VKEY_BACK: + case ui::VKEY_RETURN: + case ui::VKEY_ESCAPE: + case ui::VKEY_SPACE: + case ui::VKEY_TAB: + // In addition to the keys listed at MSDN, we include other + // graphic-character and numpad keys. + case ui::VKEY_MULTIPLY: + case ui::VKEY_ADD: + case ui::VKEY_SUBTRACT: + case ui::VKEY_DECIMAL: + case ui::VKEY_DIVIDE: + case ui::VKEY_OEM_1: + case ui::VKEY_OEM_2: + case ui::VKEY_OEM_3: + case ui::VKEY_OEM_4: + case ui::VKEY_OEM_5: + case ui::VKEY_OEM_6: + case ui::VKEY_OEM_7: + case ui::VKEY_OEM_102: + case ui::VKEY_OEM_PLUS: + case ui::VKEY_OEM_COMMA: + case ui::VKEY_OEM_MINUS: + case ui::VKEY_OEM_PERIOD: + return true; + default: + return false; + } +} + class DesktopHostLinux : public DesktopHost, public MessageLoop::DestructionObserver { public: @@ -259,14 +292,6 @@ class DesktopHostLinux : public DesktopHost, virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; virtual gfx::Point QueryMouseLocation() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; - virtual void SetInputMethod(ui::InputMethod*) OVERRIDE; - virtual ui::InputMethod* GetInputMethod() const OVERRIDE; - - // ui::internal::InputMethodDelegate Override. - virtual void DispatchKeyEventPostIME(const base::NativeEvent& event) OVERRIDE; - virtual void DispatchFabricatedKeyEventPostIME(ui::EventType type, - ui::KeyboardCode key_code, - int flags) OVERRIDE; // MessageLoop::DestructionObserver Overrides. virtual void WillDestroyCurrentMessageLoop() OVERRIDE; @@ -285,9 +310,6 @@ class DesktopHostLinux : public DesktopHost, // The native root window. ::Window root_window_; - // The input method for the desktop. - scoped_ptr<ui::InputMethod> input_method_; - // Current Aura cursor. gfx::NativeCursor current_cursor_; @@ -302,14 +324,6 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds) xdisplay_(base::MessagePumpX::GetDefaultXDisplay()), xwindow_(0), root_window_(DefaultRootWindow(xdisplay_)), -#if defined(HAVE_IBUS) - ALLOW_THIS_IN_INITIALIZER_LIST( - input_method_(new ui::InputMethodIBus(this))), -#else - ALLOW_THIS_IN_INITIALIZER_LIST( - input_method_(new ui::MockInputMethod(this))), -#endif - current_cursor_(aura::kCursorNull), bounds_(bounds) { xwindow_ = XCreateSimpleWindow(xdisplay_, root_window_, @@ -317,7 +331,7 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds) bounds.width(), bounds.height(), 0, 0, 0); - long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | + long event_mask = ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | ExposureMask | VisibilityChangeMask | @@ -335,11 +349,6 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds) base::MessagePumpX::SetDefaultDispatcher(this); MessageLoopForUI::current()->AddDestructionObserver(this); - - ::Window focused_window = None; - int revert_to = 0; - XGetInputFocus(xdisplay_, &focused_window, &revert_to); - input_method_->Init(focused_window == xwindow_); } DesktopHostLinux::~DesktopHostLinux() { @@ -363,10 +372,19 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( desktop_->ScheduleDraw(); handled = true; break; - case KeyPress: + case KeyPress: { + KeyEvent keydown_event(xev, false); + handled = desktop_->DispatchKeyEvent(&keydown_event); + if (ShouldSendCharEventForKeyboardCode(keydown_event.key_code())) { + KeyEvent char_event(xev, true); + handled |= desktop_->DispatchKeyEvent(&char_event); + } + break; + } case KeyRelease: { - input_method_->DispatchKeyEvent(xev); - handled = true; + KeyEvent keyup_event(xev, false); + handled = desktop_->DispatchKeyEvent(&keyup_event); + break; } case ButtonPress: case ButtonRelease: { @@ -444,14 +462,6 @@ base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch( XFreeEventData(xev->xgeneric.display, &last_event.xcookie); break; } - case FocusIn: { - input_method_->OnFocus(); - break; - } - case FocusOut: { - input_method_->OnBlur(); - break; - } case MapNotify: { // If there's no window manager running, we need to assign the X input // focus to our host window. @@ -601,27 +611,6 @@ bool DesktopHostLinux::IsWindowManagerPresent() { return XGetSelectionOwner(xdisplay_, wm_s0_atom) != None; } -void DesktopHostLinux::SetInputMethod(ui::InputMethod* input_method) { - input_method_.reset(input_method); -} - -ui::InputMethod* DesktopHostLinux::GetInputMethod() const { - return input_method_.get(); -} - -void DesktopHostLinux::DispatchKeyEventPostIME(const base::NativeEvent& event) { - KeyEvent aura_event(event, false /* is_char */); - desktop_->DispatchKeyEvent(&aura_event); - // We don't send a Char event here since the input method takes care of it. -} - -void DesktopHostLinux::DispatchFabricatedKeyEventPostIME( - ui::EventType type, ui::KeyboardCode key_code, int flags) { - // Dispatch a ui::VKEY_PROCESSKEY event etc. generated by |input_method_|. - KeyEvent aura_event(type, key_code, flags); - desktop_->DispatchKeyEvent(&aura_event); -} - } // namespace // static diff --git a/ui/aura/desktop_host_win.cc b/ui/aura/desktop_host_win.cc index 2e0d0e2..1809dda 100644 --- a/ui/aura/desktop_host_win.cc +++ b/ui/aura/desktop_host_win.cc @@ -11,7 +11,6 @@ #include "base/message_loop.h" #include "ui/aura/desktop.h" #include "ui/aura/event.h" -#include "ui/base/ime/mock_input_method.h" using std::max; using std::min; @@ -115,15 +114,11 @@ gfx::Size DesktopHost::GetNativeScreenSize() { DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds) : desktop_(NULL), - // TODO(yusukes): implement and use ui::InputMethodWin. - ALLOW_THIS_IN_INITIALIZER_LIST( - input_method_(new ui::MockInputMethod(this))), fullscreen_(false), saved_window_style_(0), saved_window_ex_style_(0) { Init(NULL, bounds); SetWindowText(hwnd(), L"aura::Desktop!"); - input_method_->Init(true); } DesktopHostWin::~DesktopHostWin() { @@ -242,25 +237,6 @@ void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) { hwnd(), native_event.message, native_event.wParam, native_event.lParam); } -void DesktopHostWin::SetInputMethod(ui::InputMethod* input_method) { - input_method_.reset(input_method); -} - -ui::InputMethod* DesktopHostWin::GetInputMethod() const { - return input_method_.get(); -} - -void DesktopHostWin::DispatchKeyEventPostIME(const base::NativeEvent& event) { - // TODO(yusukes): Support input method. - NOTIMPLEMENTED(); -} - -void DesktopHostWin::DispatchFabricatedKeyEventPostIME( - ui::EventType type, ui::KeyboardCode key_code, int flags) { - // TODO(yusukes): Support input method. - NOTIMPLEMENTED(); -} - void DesktopHostWin::OnClose() { // TODO: this obviously shouldn't be here. MessageLoopForUI::current()->Quit(); @@ -269,7 +245,6 @@ void DesktopHostWin::OnClose() { LRESULT DesktopHostWin::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) { - // TODO(yusukes): Support input method. MSG msg = { hwnd(), message, w_param, l_param }; KeyEvent keyev(msg, message == WM_CHAR); SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); diff --git a/ui/aura/desktop_host_win.h b/ui/aura/desktop_host_win.h index f6acdfb..cd9c136 100644 --- a/ui/aura/desktop_host_win.h +++ b/ui/aura/desktop_host_win.h @@ -7,18 +7,12 @@ #pragma once #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "ui/aura/desktop_host.h" #include "ui/base/win/window_impl.h" -namespace ui { -class InputMethod; -} // namespace ui - namespace aura { -class DesktopHostWin : public DesktopHost, - public ui::WindowImpl { +class DesktopHostWin : public DesktopHost, public ui::WindowImpl { public: explicit DesktopHostWin(const gfx::Rect& bounds); virtual ~DesktopHostWin(); @@ -38,14 +32,6 @@ class DesktopHostWin : public DesktopHost, virtual gfx::Point QueryMouseLocation() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; - virtual void SetInputMethod(ui::InputMethod* input_method) OVERRIDE; - virtual ui::InputMethod* GetInputMethod() const OVERRIDE; - - // ui::internal::InputMethodDelegate Override. - virtual void DispatchKeyEventPostIME(const base::NativeEvent& event) OVERRIDE; - virtual void DispatchFabricatedKeyEventPostIME( - ui::EventType type, ui::KeyboardCode key_code, int flags) OVERRIDE; - private: BEGIN_MSG_MAP_EX(DesktopHostWin) // Range handlers must go first! @@ -74,8 +60,6 @@ class DesktopHostWin : public DesktopHost, Desktop* desktop_; - scoped_ptr<ui::InputMethod> input_method_; - bool fullscreen_; RECT saved_window_rect_; DWORD saved_window_style_; diff --git a/ui/aura/event.h b/ui/aura/event.h index 91e92cb..5dcb726 100644 --- a/ui/aura/event.h +++ b/ui/aura/event.h @@ -144,7 +144,6 @@ class AURA_EXPORT TouchEvent : public LocatedEvent { class AURA_EXPORT KeyEvent : public Event { public: - // TODO(yusukes): Remove |is_char| when IME support for Aura is submitted. KeyEvent(const base::NativeEvent& native_event, bool is_char); // Used for synthetic events in testing. diff --git a/ui/base/keycodes/keyboard_code_conversion.cc b/ui/base/keycodes/keyboard_code_conversion.cc index 2ec06c3..0016f6d 100644 --- a/ui/base/keycodes/keyboard_code_conversion.cc +++ b/ui/base/keycodes/keyboard_code_conversion.cc @@ -56,10 +56,6 @@ uint16 GetCharacterFromKeyCode(KeyboardCode key_code, int flags) { } } - // For IME support - if (key_code == ui::VKEY_PROCESSKEY) - return 0xE5; - // Normal characters if (key_code >= VKEY_0 && key_code <= VKEY_9) { return shift ? ")!@#$%^&*("[key_code - VKEY_0] : diff --git a/ui/base/keycodes/keyboard_code_conversion_x.h b/ui/base/keycodes/keyboard_code_conversion_x.h index 950a48a..7779483 100644 --- a/ui/base/keycodes/keyboard_code_conversion_x.h +++ b/ui/base/keycodes/keyboard_code_conversion_x.h @@ -17,7 +17,6 @@ UI_EXPORT KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev); UI_EXPORT KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym); // Returns a key symbol on a standard US PC keyboard from an XEvent. -// TODO(suzhe,yusukes): Rename this to GetCharacterFromXEvent(). UI_EXPORT unsigned int DefaultSymbolFromXEvent(XEvent* xev); // Converts a KeyboardCode into an X KeySym. diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index c480722..2bdba97 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -32,7 +32,7 @@ #endif #if defined(HAVE_IBUS) -#include "ui/views/ime/input_method_bridge.h" +#include "ui/views/ime/input_method_ibus.h" #else #include "ui/views/ime/mock_input_method.h" #endif @@ -278,10 +278,8 @@ bool NativeWidgetAura::HasMouseCapture() const { InputMethod* NativeWidgetAura::CreateInputMethod() { #if defined(HAVE_IBUS) - ui::InputMethod* host = aura::Desktop::GetInstance()->GetInputMethod(); - InputMethod* input_method = new InputMethodBridge(this, host); + InputMethod* input_method = new InputMethodIBus(this); #else - // Use the mock IME for unit tests. InputMethod* input_method = new MockInputMethod(this); #endif input_method->Init(GetWidget()); @@ -573,14 +571,15 @@ void NativeWidgetAura::OnBlur() { } bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) { - // TODO(yusukes): Need an ui::InputMethod to properly handle character events. - // Right now, we just skip these. + // TODO(beng): Need an InputMethodAura to properly handle character events. + // Right now, we just skip these. if (event->is_char()) return false; DCHECK(window_->IsVisible()); InputMethod* input_method = GetWidget()->GetInputMethod(); DCHECK(input_method); + // TODO(oshima): DispatchKeyEvent should return bool? KeyEvent views_event(event); input_method->DispatchKeyEvent(views_event); return true; |