Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_window_tree_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
6 6
7 #include "base/win/metro.h" 7 #include "base/win/metro.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 19 matching lines...) Expand all
30 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" 30 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" 31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h"
32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" 32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
34 #include "ui/views/widget/root_view.h" 34 #include "ui/views/widget/root_view.h"
35 #include "ui/views/widget/widget_delegate.h" 35 #include "ui/views/widget/widget_delegate.h"
36 #include "ui/views/widget/widget_hwnd_utils.h" 36 #include "ui/views/widget/widget_hwnd_utils.h"
37 #include "ui/views/win/fullscreen_handler.h" 37 #include "ui/views/win/fullscreen_handler.h"
38 #include "ui/views/win/hwnd_message_handler.h" 38 #include "ui/views/win/hwnd_message_handler.h"
39 #include "ui/wm/core/compound_event_filter.h" 39 #include "ui/wm/core/compound_event_filter.h"
40 #include "ui/wm/core/input_method_event_filter.h"
41 #include "ui/wm/core/window_animations.h" 40 #include "ui/wm/core/window_animations.h"
42 #include "ui/wm/public/scoped_tooltip_disabler.h" 41 #include "ui/wm/public/scoped_tooltip_disabler.h"
43 42
44 DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); 43 DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*);
45 44
46 namespace views { 45 namespace views {
47 46
48 namespace { 47 namespace {
49 48
50 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { 49 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 ::ShowCursor(!!show); 545 ::ShowCursor(!!show);
547 } 546 }
548 547
549 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { 548 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) {
550 POINT cursor_location = location.ToPOINT(); 549 POINT cursor_location = location.ToPOINT();
551 ::ClientToScreen(GetHWND(), &cursor_location); 550 ::ClientToScreen(GetHWND(), &cursor_location);
552 ::SetCursorPos(cursor_location.x, cursor_location.y); 551 ::SetCursorPos(cursor_location.x, cursor_location.y);
553 } 552 }
554 553
555 //////////////////////////////////////////////////////////////////////////////// 554 ////////////////////////////////////////////////////////////////////////////////
556 // DesktopWindowTreeHostWin, ui::EventSource implementation:
557
558 ui::EventProcessor* DesktopWindowTreeHostWin::GetEventProcessor() {
559 return dispatcher();
560 }
561
562 ////////////////////////////////////////////////////////////////////////////////
563 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: 555 // DesktopWindowTreeHostWin, aura::AnimationHost implementation:
564 556
565 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( 557 void DesktopWindowTreeHostWin::SetHostTransitionOffsets(
566 const gfx::Vector2d& top_left_delta, 558 const gfx::Vector2d& top_left_delta,
567 const gfx::Vector2d& bottom_right_delta) { 559 const gfx::Vector2d& bottom_right_delta) {
568 gfx::Rect bounds_without_expansion = GetBounds(); 560 gfx::Rect bounds_without_expansion = GetBounds();
569 window_expansion_top_left_delta_ = top_left_delta; 561 window_expansion_top_left_delta_ = top_left_delta;
570 window_expansion_bottom_right_delta_ = bottom_right_delta; 562 window_expansion_bottom_right_delta_ = bottom_right_delta;
571 SetBounds(bounds_without_expansion); 563 SetBounds(bounds_without_expansion);
572 } 564 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } 664 }
673 665
674 void DesktopWindowTreeHostWin::PaintLayeredWindow(gfx::Canvas* canvas) { 666 void DesktopWindowTreeHostWin::PaintLayeredWindow(gfx::Canvas* canvas) {
675 GetWidget()->GetRootView()->Paint(ui::PaintContext(canvas)); 667 GetWidget()->GetRootView()->Paint(ui::PaintContext(canvas));
676 } 668 }
677 669
678 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() { 670 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() {
679 return GetWidget()->GetRootView()->GetNativeViewAccessible(); 671 return GetWidget()->GetRootView()->GetNativeViewAccessible();
680 } 672 }
681 673
682 InputMethod* DesktopWindowTreeHostWin::GetInputMethod() {
683 return GetWidget()->GetInputMethodDirect();
684 }
685
686 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { 674 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const {
687 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); 675 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands();
688 } 676 }
689 677
690 void DesktopWindowTreeHostWin::HandleAppDeactivated() { 678 void DesktopWindowTreeHostWin::HandleAppDeactivated() {
691 native_widget_delegate_->EnableInactiveRendering(); 679 native_widget_delegate_->EnableInactiveRendering();
692 } 680 }
693 681
694 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { 682 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) {
695 // This can be invoked from HWNDMessageHandler::Init(), at which point we're 683 // This can be invoked from HWNDMessageHandler::Init(), at which point we're
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 837
850 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, 838 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message,
851 WPARAM w_param, 839 WPARAM w_param,
852 LPARAM l_param, 840 LPARAM l_param,
853 LRESULT* result) { 841 LRESULT* result) {
854 MSG msg = {}; 842 MSG msg = {};
855 msg.hwnd = GetHWND(); 843 msg.hwnd = GetHWND();
856 msg.message = message; 844 msg.message = message;
857 msg.wParam = w_param; 845 msg.wParam = w_param;
858 msg.lParam = l_param; 846 msg.lParam = l_param;
859 return desktop_native_widget_aura_->input_method_event_filter()-> 847 return GetInputMethod()->OnUntranslatedIMEMessage(msg, result);
860 input_method()->OnUntranslatedIMEMessage(msg, result);
861 } 848 }
862 849
863 void DesktopWindowTreeHostWin::HandleInputLanguageChange( 850 void DesktopWindowTreeHostWin::HandleInputLanguageChange(
864 DWORD character_set, 851 DWORD character_set,
865 HKL input_language_id) { 852 HKL input_language_id) {
866 desktop_native_widget_aura_->input_method_event_filter()-> 853 GetInputMethod()->OnInputLocaleChanged();
867 input_method()->OnInputLocaleChanged();
868 } 854 }
869 855
870 void DesktopWindowTreeHostWin::HandlePaintAccelerated( 856 void DesktopWindowTreeHostWin::HandlePaintAccelerated(
871 const gfx::Rect& invalid_rect) { 857 const gfx::Rect& invalid_rect) {
872 if (compositor()) 858 if (compositor())
873 compositor()->ScheduleRedrawRect(invalid_rect); 859 compositor()->ScheduleRedrawRect(invalid_rect);
874 } 860 }
875 861
876 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param, 862 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param,
877 NMHDR* l_param, 863 NMHDR* l_param,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 941
956 // static 942 // static
957 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 943 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
958 internal::NativeWidgetDelegate* native_widget_delegate, 944 internal::NativeWidgetDelegate* native_widget_delegate,
959 DesktopNativeWidgetAura* desktop_native_widget_aura) { 945 DesktopNativeWidgetAura* desktop_native_widget_aura) {
960 return new DesktopWindowTreeHostWin(native_widget_delegate, 946 return new DesktopWindowTreeHostWin(native_widget_delegate,
961 desktop_native_widget_aura); 947 desktop_native_widget_aura);
962 } 948 }
963 949
964 } // namespace views 950 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698