| 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 "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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
| 52 // DesktopRootWindowHostWin, public: | 52 // DesktopRootWindowHostWin, public: |
| 53 | 53 |
| 54 DesktopRootWindowHostWin::DesktopRootWindowHostWin( | 54 DesktopRootWindowHostWin::DesktopRootWindowHostWin( |
| 55 internal::NativeWidgetDelegate* native_widget_delegate, | 55 internal::NativeWidgetDelegate* native_widget_delegate, |
| 56 DesktopNativeWidgetAura* desktop_native_widget_aura) | 56 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 57 : root_window_(NULL), | 57 : root_window_(NULL), |
| 58 message_handler_(new HWNDMessageHandler(this)), | 58 message_handler_(new HWNDMessageHandler(this)), |
| 59 native_widget_delegate_(native_widget_delegate), | 59 native_widget_delegate_(native_widget_delegate), |
| 60 desktop_native_widget_aura_(desktop_native_widget_aura), | 60 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 61 root_window_host_delegate_(NULL), | |
| 62 content_window_(NULL), | 61 content_window_(NULL), |
| 63 drag_drop_client_(NULL), | 62 drag_drop_client_(NULL), |
| 64 should_animate_window_close_(false), | 63 should_animate_window_close_(false), |
| 65 pending_close_(false), | 64 pending_close_(false), |
| 66 has_non_client_view_(false), | 65 has_non_client_view_(false), |
| 67 tooltip_(NULL) { | 66 tooltip_(NULL) { |
| 68 } | 67 } |
| 69 | 68 |
| 70 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { | 69 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { |
| 71 // WARNING: |content_window_| has been destroyed by the time we get here. | 70 // WARNING: |content_window_| has been destroyed by the time we get here. |
| 72 desktop_native_widget_aura_->OnDesktopRootWindowHostDestroyed( | 71 desktop_native_widget_aura_->OnDesktopRootWindowHostDestroyed( |
| 73 root_window_); | 72 root_window_); |
| 74 } | 73 } |
| 75 | 74 |
| 76 // static | 75 // static |
| 77 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { | 76 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { |
| 78 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); | 77 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); |
| 79 return root ? root->window()->GetProperty(kContentWindowForRootWindow) : NULL; | 78 return root ? root->window()->GetProperty(kContentWindowForRootWindow) : NULL; |
| 80 } | 79 } |
| 81 | 80 |
| 82 // static | 81 // static |
| 83 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | 82 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
| 84 // Use NativeThemeWin for windows shown on the desktop, those not on the | 83 // Use NativeThemeWin for windows shown on the desktop, those not on the |
| 85 // desktop come from Ash and get NativeThemeAura. | 84 // desktop come from Ash and get NativeThemeAura. |
| 86 aura::WindowEventDispatcher* dispatcher = | 85 aura::WindowEventDispatcher* dispatcher = |
| 87 window ? window->GetDispatcher() : NULL; | 86 window ? window->GetDispatcher() : NULL; |
| 88 if (dispatcher) { | 87 if (dispatcher) { |
| 89 HWND host_hwnd = dispatcher->GetAcceleratedWidget(); | 88 HWND host_hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 90 if (host_hwnd && | 89 if (host_hwnd && |
| 91 DesktopRootWindowHostWin::GetContentWindowForHWND(host_hwnd)) { | 90 DesktopRootWindowHostWin::GetContentWindowForHWND(host_hwnd)) { |
| 92 return ui::NativeThemeWin::instance(); | 91 return ui::NativeThemeWin::instance(); |
| 93 } | 92 } |
| 94 } | 93 } |
| 95 return ui::NativeThemeAura::instance(); | 94 return ui::NativeThemeAura::instance(); |
| 96 } | 95 } |
| 97 | 96 |
| 98 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
| 99 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: | 98 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: |
| 100 | 99 |
| 101 void DesktopRootWindowHostWin::Init( | 100 void DesktopRootWindowHostWin::Init( |
| 102 aura::Window* content_window, | 101 aura::Window* content_window, |
| 103 const Widget::InitParams& params, | 102 const Widget::InitParams& params, |
| 104 aura::RootWindow::CreateParams* rw_create_params) { | 103 aura::RootWindow::CreateParams* rw_create_params) { |
| 105 // TODO(beng): SetInitParams(). | 104 // TODO(beng): SetInitParams(). |
| 106 content_window_ = content_window; | 105 content_window_ = content_window; |
| 107 | 106 |
| 108 aura::client::SetAnimationHost(content_window_, this); | 107 aura::client::SetAnimationHost(content_window_, this); |
| 109 | 108 |
| 110 ConfigureWindowStyles(message_handler_.get(), params, | 109 ConfigureWindowStyles(message_handler_.get(), params, |
| 111 GetWidget()->widget_delegate(), | 110 GetWidget()->widget_delegate(), |
| 112 native_widget_delegate_); | 111 native_widget_delegate_); |
| 113 | 112 |
| 114 HWND parent_hwnd = NULL; | 113 HWND parent_hwnd = NULL; |
| 115 if (params.parent && params.parent->GetDispatcher()) | 114 if (params.parent && params.parent->GetDispatcher()) { |
| 116 parent_hwnd = params.parent->GetDispatcher()->GetAcceleratedWidget(); | 115 parent_hwnd = |
| 116 params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 117 } |
| 117 | 118 |
| 118 message_handler_->set_remove_standard_frame(params.remove_standard_frame); | 119 message_handler_->set_remove_standard_frame(params.remove_standard_frame); |
| 119 | 120 |
| 120 has_non_client_view_ = Widget::RequiresNonClientView(params.type); | 121 has_non_client_view_ = Widget::RequiresNonClientView(params.type); |
| 121 | 122 |
| 122 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); | 123 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); |
| 123 message_handler_->Init(parent_hwnd, pixel_bounds); | 124 message_handler_->Init(parent_hwnd, pixel_bounds); |
| 124 | 125 |
| 125 rw_create_params->host = this; | 126 rw_create_params->host = this; |
| 126 } | 127 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void DesktopRootWindowHostWin::OnNativeWidgetBlur() { | 371 void DesktopRootWindowHostWin::OnNativeWidgetBlur() { |
| 371 } | 372 } |
| 372 | 373 |
| 373 bool DesktopRootWindowHostWin::IsAnimatingClosed() const { | 374 bool DesktopRootWindowHostWin::IsAnimatingClosed() const { |
| 374 return pending_close_; | 375 return pending_close_; |
| 375 } | 376 } |
| 376 | 377 |
| 377 //////////////////////////////////////////////////////////////////////////////// | 378 //////////////////////////////////////////////////////////////////////////////// |
| 378 // DesktopRootWindowHostWin, RootWindowHost implementation: | 379 // DesktopRootWindowHostWin, RootWindowHost implementation: |
| 379 | 380 |
| 380 | |
| 381 void DesktopRootWindowHostWin::SetDelegate( | |
| 382 aura::RootWindowHostDelegate* delegate) { | |
| 383 root_window_host_delegate_ = delegate; | |
| 384 } | |
| 385 | |
| 386 aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() { | 381 aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() { |
| 387 return root_window_; | 382 return root_window_; |
| 388 } | 383 } |
| 389 | 384 |
| 390 gfx::AcceleratedWidget DesktopRootWindowHostWin::GetAcceleratedWidget() { | 385 gfx::AcceleratedWidget DesktopRootWindowHostWin::GetAcceleratedWidget() { |
| 391 return message_handler_->hwnd(); | 386 return message_handler_->hwnd(); |
| 392 } | 387 } |
| 393 | 388 |
| 394 void DesktopRootWindowHostWin::Show() { | 389 void DesktopRootWindowHostWin::Show() { |
| 395 message_handler_->Show(); | 390 message_handler_->Show(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 void DesktopRootWindowHostWin::OnCursorVisibilityChanged(bool show) { | 485 void DesktopRootWindowHostWin::OnCursorVisibilityChanged(bool show) { |
| 491 ::ShowCursor(!!show); | 486 ::ShowCursor(!!show); |
| 492 } | 487 } |
| 493 | 488 |
| 494 void DesktopRootWindowHostWin::MoveCursorTo(const gfx::Point& location) { | 489 void DesktopRootWindowHostWin::MoveCursorTo(const gfx::Point& location) { |
| 495 POINT cursor_location = location.ToPOINT(); | 490 POINT cursor_location = location.ToPOINT(); |
| 496 ::ClientToScreen(GetHWND(), &cursor_location); | 491 ::ClientToScreen(GetHWND(), &cursor_location); |
| 497 ::SetCursorPos(cursor_location.x, cursor_location.y); | 492 ::SetCursorPos(cursor_location.x, cursor_location.y); |
| 498 } | 493 } |
| 499 | 494 |
| 500 void DesktopRootWindowHostWin::SetFocusWhenShown(bool focus_when_shown) { | |
| 501 } | |
| 502 | |
| 503 void DesktopRootWindowHostWin::PostNativeEvent( | 495 void DesktopRootWindowHostWin::PostNativeEvent( |
| 504 const base::NativeEvent& native_event) { | 496 const base::NativeEvent& native_event) { |
| 505 } | 497 } |
| 506 | 498 |
| 507 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( | 499 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( |
| 508 float device_scale_factor) { | 500 float device_scale_factor) { |
| 509 } | 501 } |
| 510 | 502 |
| 511 void DesktopRootWindowHostWin::PrepareForShutdown() { | 503 void DesktopRootWindowHostWin::PrepareForShutdown() { |
| 512 } | 504 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); | 636 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); |
| 645 } | 637 } |
| 646 | 638 |
| 647 void DesktopRootWindowHostWin::HandleAppDeactivated() { | 639 void DesktopRootWindowHostWin::HandleAppDeactivated() { |
| 648 native_widget_delegate_->EnableInactiveRendering(); | 640 native_widget_delegate_->EnableInactiveRendering(); |
| 649 } | 641 } |
| 650 | 642 |
| 651 void DesktopRootWindowHostWin::HandleActivationChanged(bool active) { | 643 void DesktopRootWindowHostWin::HandleActivationChanged(bool active) { |
| 652 // This can be invoked from HWNDMessageHandler::Init(), at which point we're | 644 // This can be invoked from HWNDMessageHandler::Init(), at which point we're |
| 653 // not in a good state and need to ignore it. | 645 // not in a good state and need to ignore it. |
| 654 if (!root_window_host_delegate_) | 646 if (!delegate_) |
| 655 return; | 647 return; |
| 656 | 648 |
| 657 if (active) | 649 if (active) |
| 658 root_window_host_delegate_->OnHostActivated(); | 650 delegate_->OnHostActivated(); |
| 659 desktop_native_widget_aura_->HandleActivationChanged(active); | 651 desktop_native_widget_aura_->HandleActivationChanged(active); |
| 660 } | 652 } |
| 661 | 653 |
| 662 bool DesktopRootWindowHostWin::HandleAppCommand(short command) { | 654 bool DesktopRootWindowHostWin::HandleAppCommand(short command) { |
| 663 // We treat APPCOMMAND ids as an extension of our command namespace, and just | 655 // We treat APPCOMMAND ids as an extension of our command namespace, and just |
| 664 // let the delegate figure out what to do... | 656 // let the delegate figure out what to do... |
| 665 return GetWidget()->widget_delegate() && | 657 return GetWidget()->widget_delegate() && |
| 666 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 658 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
| 667 } | 659 } |
| 668 | 660 |
| 669 void DesktopRootWindowHostWin::HandleCancelMode() { | 661 void DesktopRootWindowHostWin::HandleCancelMode() { |
| 670 root_window_host_delegate_->OnHostCancelMode(); | 662 delegate_->OnHostCancelMode(); |
| 671 } | 663 } |
| 672 | 664 |
| 673 void DesktopRootWindowHostWin::HandleCaptureLost() { | 665 void DesktopRootWindowHostWin::HandleCaptureLost() { |
| 674 root_window_host_delegate_->OnHostLostWindowCapture(); | 666 delegate_->OnHostLostWindowCapture(); |
| 675 native_widget_delegate_->OnMouseCaptureLost(); | 667 native_widget_delegate_->OnMouseCaptureLost(); |
| 676 } | 668 } |
| 677 | 669 |
| 678 void DesktopRootWindowHostWin::HandleClose() { | 670 void DesktopRootWindowHostWin::HandleClose() { |
| 679 GetWidget()->Close(); | 671 GetWidget()->Close(); |
| 680 } | 672 } |
| 681 | 673 |
| 682 bool DesktopRootWindowHostWin::HandleCommand(int command) { | 674 bool DesktopRootWindowHostWin::HandleCommand(int command) { |
| 683 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 675 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
| 684 } | 676 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 void DesktopRootWindowHostWin::HandleBeginWMSizeMove() { | 710 void DesktopRootWindowHostWin::HandleBeginWMSizeMove() { |
| 719 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); | 711 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); |
| 720 } | 712 } |
| 721 | 713 |
| 722 void DesktopRootWindowHostWin::HandleEndWMSizeMove() { | 714 void DesktopRootWindowHostWin::HandleEndWMSizeMove() { |
| 723 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); | 715 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); |
| 724 } | 716 } |
| 725 | 717 |
| 726 void DesktopRootWindowHostWin::HandleMove() { | 718 void DesktopRootWindowHostWin::HandleMove() { |
| 727 native_widget_delegate_->OnNativeWidgetMove(); | 719 native_widget_delegate_->OnNativeWidgetMove(); |
| 728 if (root_window_host_delegate_) | 720 if (delegate_) |
| 729 root_window_host_delegate_->OnHostMoved(GetBounds().origin()); | 721 delegate_->OnHostMoved(GetBounds().origin()); |
| 730 } | 722 } |
| 731 | 723 |
| 732 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { | 724 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { |
| 733 GetWidget()->widget_delegate()->OnWorkAreaChanged(); | 725 GetWidget()->widget_delegate()->OnWorkAreaChanged(); |
| 734 } | 726 } |
| 735 | 727 |
| 736 void DesktopRootWindowHostWin::HandleVisibilityChanging(bool visible) { | 728 void DesktopRootWindowHostWin::HandleVisibilityChanging(bool visible) { |
| 737 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); | 729 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
| 738 } | 730 } |
| 739 | 731 |
| 740 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { | 732 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { |
| 741 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 733 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 742 } | 734 } |
| 743 | 735 |
| 744 void DesktopRootWindowHostWin::HandleClientSizeChanged( | 736 void DesktopRootWindowHostWin::HandleClientSizeChanged( |
| 745 const gfx::Size& new_size) { | 737 const gfx::Size& new_size) { |
| 746 if (root_window_host_delegate_) | 738 if (delegate_) |
| 747 root_window_host_delegate_->OnHostResized(new_size); | 739 delegate_->OnHostResized(new_size); |
| 748 } | 740 } |
| 749 | 741 |
| 750 void DesktopRootWindowHostWin::HandleFrameChanged() { | 742 void DesktopRootWindowHostWin::HandleFrameChanged() { |
| 751 SetWindowTransparency(); | 743 SetWindowTransparency(); |
| 752 // Replace the frame and layout the contents. | 744 // Replace the frame and layout the contents. |
| 753 GetWidget()->non_client_view()->UpdateFrame(true); | 745 GetWidget()->non_client_view()->UpdateFrame(true); |
| 754 } | 746 } |
| 755 | 747 |
| 756 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { | 748 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { |
| 757 // TODO(beng): inform the native_widget_delegate_. | 749 // TODO(beng): inform the native_widget_delegate_. |
| 758 InputMethod* input_method = GetInputMethod(); | 750 InputMethod* input_method = GetInputMethod(); |
| 759 if (input_method) | 751 if (input_method) |
| 760 input_method->OnFocus(); | 752 input_method->OnFocus(); |
| 761 } | 753 } |
| 762 | 754 |
| 763 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { | 755 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { |
| 764 // TODO(beng): inform the native_widget_delegate_. | 756 // TODO(beng): inform the native_widget_delegate_. |
| 765 InputMethod* input_method = GetInputMethod(); | 757 InputMethod* input_method = GetInputMethod(); |
| 766 if (input_method) | 758 if (input_method) |
| 767 input_method->OnBlur(); | 759 input_method->OnBlur(); |
| 768 } | 760 } |
| 769 | 761 |
| 770 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { | 762 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { |
| 771 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) | 763 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) |
| 772 ui::TSFBridge::GetInstance()->CancelComposition(); | 764 ui::TSFBridge::GetInstance()->CancelComposition(); |
| 773 return root_window_host_delegate_->OnHostMouseEvent( | 765 return delegate_->OnHostMouseEvent(const_cast<ui::MouseEvent*>(&event)); |
| 774 const_cast<ui::MouseEvent*>(&event)); | |
| 775 } | 766 } |
| 776 | 767 |
| 777 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { | 768 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { |
| 778 return false; | 769 return false; |
| 779 } | 770 } |
| 780 | 771 |
| 781 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( | 772 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( |
| 782 const ui::KeyEvent& event) { | 773 const ui::KeyEvent& event) { |
| 783 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); | 774 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); |
| 784 return static_cast<aura::RootWindowHostDelegate*>(root_window_)-> | 775 return delegate_->OnHostKeyEvent(duplicate_event.get()); |
| 785 OnHostKeyEvent(duplicate_event.get()); | |
| 786 } | 776 } |
| 787 | 777 |
| 788 void DesktopRootWindowHostWin::HandleTouchEvent( | 778 void DesktopRootWindowHostWin::HandleTouchEvent( |
| 789 const ui::TouchEvent& event) { | 779 const ui::TouchEvent& event) { |
| 790 // HWNDMessageHandler asynchronously processes touch events. Because of this | 780 // HWNDMessageHandler asynchronously processes touch events. Because of this |
| 791 // it's possible for the aura::RootWindow to have been destroyed by the time | 781 // it's possible for the aura::RootWindow to have been destroyed by the time |
| 792 // we attempt to process them. | 782 // we attempt to process them. |
| 793 if (!GetWidget()->GetNativeView()) | 783 if (!GetWidget()->GetNativeView()) |
| 794 return; | 784 return; |
| 795 | 785 |
| 796 // Currently we assume the window that has capture gets touch events too. | 786 // Currently we assume the window that has capture gets touch events too. |
| 797 aura::RootWindow* root = | 787 aura::RootWindow* root = |
| 798 aura::RootWindow::GetForAcceleratedWidget(GetCapture()); | 788 aura::RootWindow::GetForAcceleratedWidget(GetCapture()); |
| 799 if (root) { | 789 if (root) { |
| 800 DesktopRootWindowHostWin* target = | 790 DesktopRootWindowHostWin* target = |
| 801 root->window()->GetProperty(kDesktopRootWindowHostKey); | 791 root->window()->GetProperty(kDesktopRootWindowHostKey); |
| 802 if (target && target->HasCapture() && target != this) { | 792 if (target && target->HasCapture() && target != this) { |
| 803 POINT target_location(event.location().ToPOINT()); | 793 POINT target_location(event.location().ToPOINT()); |
| 804 ClientToScreen(GetHWND(), &target_location); | 794 ClientToScreen(GetHWND(), &target_location); |
| 805 ScreenToClient(target->GetHWND(), &target_location); | 795 ScreenToClient(target->GetHWND(), &target_location); |
| 806 ui::TouchEvent target_event(event, static_cast<View*>(NULL), | 796 ui::TouchEvent target_event(event, static_cast<View*>(NULL), |
| 807 static_cast<View*>(NULL)); | 797 static_cast<View*>(NULL)); |
| 808 target_event.set_location(gfx::Point(target_location)); | 798 target_event.set_location(gfx::Point(target_location)); |
| 809 target_event.set_root_location(target_event.location()); | 799 target_event.set_root_location(target_event.location()); |
| 810 target->root_window_host_delegate_->OnHostTouchEvent(&target_event); | 800 target->delegate_->OnHostTouchEvent(&target_event); |
| 811 return; | 801 return; |
| 812 } | 802 } |
| 813 } | 803 } |
| 814 root_window_host_delegate_->OnHostTouchEvent( | 804 delegate_->OnHostTouchEvent( |
| 815 const_cast<ui::TouchEvent*>(&event)); | 805 const_cast<ui::TouchEvent*>(&event)); |
| 816 } | 806 } |
| 817 | 807 |
| 818 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, | 808 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, |
| 819 WPARAM w_param, | 809 WPARAM w_param, |
| 820 LPARAM l_param, | 810 LPARAM l_param, |
| 821 LRESULT* result) { | 811 LRESULT* result) { |
| 822 MSG msg = {}; | 812 MSG msg = {}; |
| 823 msg.hwnd = GetHWND(); | 813 msg.hwnd = GetHWND(); |
| 824 msg.message = message; | 814 msg.message = message; |
| 825 msg.wParam = w_param; | 815 msg.wParam = w_param; |
| 826 msg.lParam = l_param; | 816 msg.lParam = l_param; |
| 827 return desktop_native_widget_aura_->input_method_event_filter()-> | 817 return desktop_native_widget_aura_->input_method_event_filter()-> |
| 828 input_method()->OnUntranslatedIMEMessage(msg, result); | 818 input_method()->OnUntranslatedIMEMessage(msg, result); |
| 829 } | 819 } |
| 830 | 820 |
| 831 void DesktopRootWindowHostWin::HandleInputLanguageChange( | 821 void DesktopRootWindowHostWin::HandleInputLanguageChange( |
| 832 DWORD character_set, | 822 DWORD character_set, |
| 833 HKL input_language_id) { | 823 HKL input_language_id) { |
| 834 desktop_native_widget_aura_->input_method_event_filter()-> | 824 desktop_native_widget_aura_->input_method_event_filter()-> |
| 835 input_method()->OnInputLocaleChanged(); | 825 input_method()->OnInputLocaleChanged(); |
| 836 } | 826 } |
| 837 | 827 |
| 838 bool DesktopRootWindowHostWin::HandlePaintAccelerated( | 828 bool DesktopRootWindowHostWin::HandlePaintAccelerated( |
| 839 const gfx::Rect& invalid_rect) { | 829 const gfx::Rect& invalid_rect) { |
| 840 return native_widget_delegate_->OnNativeWidgetPaintAccelerated(invalid_rect); | 830 return native_widget_delegate_->OnNativeWidgetPaintAccelerated(invalid_rect); |
| 841 } | 831 } |
| 842 | 832 |
| 843 void DesktopRootWindowHostWin::HandlePaint(gfx::Canvas* canvas) { | 833 void DesktopRootWindowHostWin::HandlePaint(gfx::Canvas* canvas) { |
| 844 root_window_host_delegate_->OnHostPaint(gfx::Rect()); | 834 delegate_->OnHostPaint(gfx::Rect()); |
| 845 } | 835 } |
| 846 | 836 |
| 847 bool DesktopRootWindowHostWin::HandleTooltipNotify(int w_param, | 837 bool DesktopRootWindowHostWin::HandleTooltipNotify(int w_param, |
| 848 NMHDR* l_param, | 838 NMHDR* l_param, |
| 849 LRESULT* l_result) { | 839 LRESULT* l_result) { |
| 850 return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result); | 840 return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result); |
| 851 } | 841 } |
| 852 | 842 |
| 853 void DesktopRootWindowHostWin::HandleTooltipMouseMove(UINT message, | 843 void DesktopRootWindowHostWin::HandleTooltipMouseMove(UINT message, |
| 854 WPARAM w_param, | 844 WPARAM w_param, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 903 |
| 914 // static | 904 // static |
| 915 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 905 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 916 internal::NativeWidgetDelegate* native_widget_delegate, | 906 internal::NativeWidgetDelegate* native_widget_delegate, |
| 917 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 907 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 918 return new DesktopRootWindowHostWin(native_widget_delegate, | 908 return new DesktopRootWindowHostWin(native_widget_delegate, |
| 919 desktop_native_widget_aura); | 909 desktop_native_widget_aura); |
| 920 } | 910 } |
| 921 | 911 |
| 922 } // namespace views | 912 } // namespace views |
| OLD | NEW |