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

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

Issue 188223002: Clean up WindowEventDispatcher some more. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { 579 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) {
580 POINT cursor_location = location.ToPOINT(); 580 POINT cursor_location = location.ToPOINT();
581 ::ClientToScreen(GetHWND(), &cursor_location); 581 ::ClientToScreen(GetHWND(), &cursor_location);
582 ::SetCursorPos(cursor_location.x, cursor_location.y); 582 ::SetCursorPos(cursor_location.x, cursor_location.y);
583 } 583 }
584 584
585 //////////////////////////////////////////////////////////////////////////////// 585 ////////////////////////////////////////////////////////////////////////////////
586 // DesktopWindowTreeHostWin, ui::EventSource implementation: 586 // DesktopWindowTreeHostWin, ui::EventSource implementation:
587 587
588 ui::EventProcessor* DesktopWindowTreeHostWin::GetEventProcessor() { 588 ui::EventProcessor* DesktopWindowTreeHostWin::GetEventProcessor() {
589 return delegate_->GetEventProcessor(); 589 return dispatcher();
590 } 590 }
591 591
592 //////////////////////////////////////////////////////////////////////////////// 592 ////////////////////////////////////////////////////////////////////////////////
593 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: 593 // DesktopWindowTreeHostWin, aura::AnimationHost implementation:
594 594
595 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( 595 void DesktopWindowTreeHostWin::SetHostTransitionOffsets(
596 const gfx::Vector2d& top_left_delta, 596 const gfx::Vector2d& top_left_delta,
597 const gfx::Vector2d& bottom_right_delta) { 597 const gfx::Vector2d& bottom_right_delta) {
598 gfx::Rect bounds_without_expansion = GetBounds(); 598 gfx::Rect bounds_without_expansion = GetBounds();
599 window_expansion_top_left_delta_ = top_left_delta; 599 window_expansion_top_left_delta_ = top_left_delta;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); 729 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands();
730 } 730 }
731 731
732 void DesktopWindowTreeHostWin::HandleAppDeactivated() { 732 void DesktopWindowTreeHostWin::HandleAppDeactivated() {
733 native_widget_delegate_->EnableInactiveRendering(); 733 native_widget_delegate_->EnableInactiveRendering();
734 } 734 }
735 735
736 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { 736 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) {
737 // This can be invoked from HWNDMessageHandler::Init(), at which point we're 737 // This can be invoked from HWNDMessageHandler::Init(), at which point we're
738 // not in a good state and need to ignore it. 738 // not in a good state and need to ignore it.
739 if (!delegate_) 739 // TODO(beng): Do we need this still now the host owns the dispatcher?
740 if (!dispatcher())
740 return; 741 return;
741 742
742 if (active) 743 if (active)
743 delegate_->OnHostActivated(); 744 OnHostActivated();
744 desktop_native_widget_aura_->HandleActivationChanged(active); 745 desktop_native_widget_aura_->HandleActivationChanged(active);
745 } 746 }
746 747
747 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { 748 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) {
748 // We treat APPCOMMAND ids as an extension of our command namespace, and just 749 // We treat APPCOMMAND ids as an extension of our command namespace, and just
749 // let the delegate figure out what to do... 750 // let the delegate figure out what to do...
750 return GetWidget()->widget_delegate() && 751 return GetWidget()->widget_delegate() &&
751 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); 752 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command);
752 } 753 }
753 754
754 void DesktopWindowTreeHostWin::HandleCancelMode() { 755 void DesktopWindowTreeHostWin::HandleCancelMode() {
755 delegate_->OnHostCancelMode(); 756 dispatcher()->DispatchCancelModeEvent();
756 } 757 }
757 758
758 void DesktopWindowTreeHostWin::HandleCaptureLost() { 759 void DesktopWindowTreeHostWin::HandleCaptureLost() {
759 delegate_->OnHostLostWindowCapture(); 760 OnHostLostWindowCapture();
760 native_widget_delegate_->OnMouseCaptureLost(); 761 native_widget_delegate_->OnMouseCaptureLost();
761 } 762 }
762 763
763 void DesktopWindowTreeHostWin::HandleClose() { 764 void DesktopWindowTreeHostWin::HandleClose() {
764 GetWidget()->Close(); 765 GetWidget()->Close();
765 } 766 }
766 767
767 bool DesktopWindowTreeHostWin::HandleCommand(int command) { 768 bool DesktopWindowTreeHostWin::HandleCommand(int command) {
768 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); 769 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command);
769 } 770 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { 820 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) {
820 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); 821 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible);
821 } 822 }
822 823
823 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { 824 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) {
824 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); 825 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible);
825 } 826 }
826 827
827 void DesktopWindowTreeHostWin::HandleClientSizeChanged( 828 void DesktopWindowTreeHostWin::HandleClientSizeChanged(
828 const gfx::Size& new_size) { 829 const gfx::Size& new_size) {
829 if (delegate_) 830 if (dispatcher())
830 OnHostResized(new_size); 831 OnHostResized(new_size);
831 } 832 }
832 833
833 void DesktopWindowTreeHostWin::HandleFrameChanged() { 834 void DesktopWindowTreeHostWin::HandleFrameChanged() {
834 SetWindowTransparency(); 835 SetWindowTransparency();
835 // Replace the frame and layout the contents. 836 // Replace the frame and layout the contents.
836 GetWidget()->non_client_view()->UpdateFrame(); 837 GetWidget()->non_client_view()->UpdateFrame();
837 } 838 }
838 839
839 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { 840 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1010
1010 // static 1011 // static
1011 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 1012 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
1012 internal::NativeWidgetDelegate* native_widget_delegate, 1013 internal::NativeWidgetDelegate* native_widget_delegate,
1013 DesktopNativeWidgetAura* desktop_native_widget_aura) { 1014 DesktopNativeWidgetAura* desktop_native_widget_aura) {
1014 return new DesktopWindowTreeHostWin(native_widget_delegate, 1015 return new DesktopWindowTreeHostWin(native_widget_delegate,
1015 desktop_native_widget_aura); 1016 desktop_native_widget_aura);
1016 } 1017 }
1017 1018
1018 } // namespace views 1019 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_x11_unittest.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698