| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
| 6 | 6 |
| 7 #include "base/win/metro.h" |
| 7 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 8 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/focus_manager.h" | 11 #include "ui/aura/focus_manager.h" |
| 11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
| 13 #include "ui/base/cursor/cursor_loader_win.h" | 14 #include "ui/base/cursor/cursor_loader_win.h" |
| 14 #include "ui/base/ime/input_method_win.h" | 15 #include "ui/base/ime/input_method_win.h" |
| 16 #include "ui/base/ime/win/tsf_bridge.h" |
| 15 #include "ui/base/win/dpi.h" | 17 #include "ui/base/win/dpi.h" |
| 16 #include "ui/base/win/shell.h" | 18 #include "ui/base/win/shell.h" |
| 17 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/path_win.h" | 21 #include "ui/gfx/path_win.h" |
| 20 #include "ui/native_theme/native_theme_aura.h" | 22 #include "ui/native_theme/native_theme_aura.h" |
| 21 #include "ui/native_theme/native_theme_win.h" | 23 #include "ui/native_theme/native_theme_win.h" |
| 22 #include "ui/views/corewm/compound_event_filter.h" | 24 #include "ui/views/corewm/compound_event_filter.h" |
| 23 #include "ui/views/corewm/corewm_switches.h" | 25 #include "ui/views/corewm/corewm_switches.h" |
| 24 #include "ui/views/corewm/cursor_manager.h" | 26 #include "ui/views/corewm/cursor_manager.h" |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 } | 745 } |
| 744 | 746 |
| 745 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { | 747 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { |
| 746 // TODO(beng): inform the native_widget_delegate_. | 748 // TODO(beng): inform the native_widget_delegate_. |
| 747 InputMethod* input_method = GetInputMethod(); | 749 InputMethod* input_method = GetInputMethod(); |
| 748 if (input_method) | 750 if (input_method) |
| 749 input_method->OnBlur(); | 751 input_method->OnBlur(); |
| 750 } | 752 } |
| 751 | 753 |
| 752 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { | 754 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { |
| 755 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) |
| 756 ui::TSFBridge::GetInstance()->CancelComposition(); |
| 753 return root_window_host_delegate_->OnHostMouseEvent( | 757 return root_window_host_delegate_->OnHostMouseEvent( |
| 754 const_cast<ui::MouseEvent*>(&event)); | 758 const_cast<ui::MouseEvent*>(&event)); |
| 755 } | 759 } |
| 756 | 760 |
| 757 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { | 761 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { |
| 758 return false; | 762 return false; |
| 759 } | 763 } |
| 760 | 764 |
| 761 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( | 765 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( |
| 762 const ui::KeyEvent& event) { | 766 const ui::KeyEvent& event) { |
| 763 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); | 767 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); |
| 764 return static_cast<aura::RootWindowHostDelegate*>(root_window_)-> | 768 return static_cast<aura::RootWindowHostDelegate*>(root_window_)-> |
| 765 OnHostKeyEvent(duplicate_event.get()); | 769 OnHostKeyEvent(duplicate_event.get()); |
| 766 } | 770 } |
| 767 | 771 |
| 768 bool DesktopRootWindowHostWin::HandleTouchEvent( | 772 bool DesktopRootWindowHostWin::HandleTouchEvent( |
| 769 const ui::TouchEvent& event) { | 773 const ui::TouchEvent& event) { |
| 770 return root_window_host_delegate_->OnHostTouchEvent( | 774 return root_window_host_delegate_->OnHostTouchEvent( |
| 771 const_cast<ui::TouchEvent*>(&event)); | 775 const_cast<ui::TouchEvent*>(&event)); |
| 772 } | 776 } |
| 773 | 777 |
| 774 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, | 778 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, |
| 775 WPARAM w_param, | 779 WPARAM w_param, |
| 776 LPARAM l_param, | 780 LPARAM l_param, |
| 777 LRESULT* result) { | 781 LRESULT* result) { |
| 778 // TODO(ime): Having to cast here is wrong. Maybe we should have IME events | 782 // TODO(ime): Having to cast here is wrong. Maybe we should have IME events |
| 779 // and have these flow through the same path as HandleUntranslatedKeyEvent() | 783 // and have these flow through the same path as |
| 780 // does. | 784 // HandleUnHandletranslatedKeyEvent() does. |
| 781 ui::InputMethodWin* ime_win = | 785 ui::InputMethodWin* ime_win = |
| 782 static_cast<ui::InputMethodWin*>( | 786 static_cast<ui::InputMethodWin*>( |
| 783 desktop_native_widget_aura_->input_method_event_filter()-> | 787 desktop_native_widget_aura_->input_method_event_filter()-> |
| 784 input_method()); | 788 input_method()); |
| 785 BOOL handled = FALSE; | 789 BOOL handled = FALSE; |
| 786 *result = ime_win->OnImeMessages(message, w_param, l_param, &handled); | 790 *result = ime_win->OnImeMessages(message, w_param, l_param, &handled); |
| 787 return !!handled; | 791 return !!handled; |
| 788 } | 792 } |
| 789 | 793 |
| 790 void DesktopRootWindowHostWin::HandleInputLanguageChange( | 794 void DesktopRootWindowHostWin::HandleInputLanguageChange( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 856 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 853 internal::NativeWidgetDelegate* native_widget_delegate, | 857 internal::NativeWidgetDelegate* native_widget_delegate, |
| 854 DesktopNativeWidgetAura* desktop_native_widget_aura, | 858 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 855 const gfx::Rect& initial_bounds) { | 859 const gfx::Rect& initial_bounds) { |
| 856 return new DesktopRootWindowHostWin(native_widget_delegate, | 860 return new DesktopRootWindowHostWin(native_widget_delegate, |
| 857 desktop_native_widget_aura, | 861 desktop_native_widget_aura, |
| 858 initial_bounds); | 862 initial_bounds); |
| 859 } | 863 } |
| 860 | 864 |
| 861 } // namespace views | 865 } // namespace views |
| OLD | NEW |