| 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_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 Loading... |
| 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 dispatcher(); | 589 return delegate_->GetEventProcessor(); |
| 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 Loading... |
| 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 // TODO(beng): Do we need this still now the host owns the dispatcher? | 739 if (!delegate_) |
| 740 if (!dispatcher()) | |
| 741 return; | 740 return; |
| 742 | 741 |
| 743 if (active) | 742 if (active) |
| 744 OnHostActivated(); | 743 delegate_->OnHostActivated(); |
| 745 desktop_native_widget_aura_->HandleActivationChanged(active); | 744 desktop_native_widget_aura_->HandleActivationChanged(active); |
| 746 } | 745 } |
| 747 | 746 |
| 748 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { | 747 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { |
| 749 // We treat APPCOMMAND ids as an extension of our command namespace, and just | 748 // We treat APPCOMMAND ids as an extension of our command namespace, and just |
| 750 // let the delegate figure out what to do... | 749 // let the delegate figure out what to do... |
| 751 return GetWidget()->widget_delegate() && | 750 return GetWidget()->widget_delegate() && |
| 752 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 751 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
| 753 } | 752 } |
| 754 | 753 |
| 755 void DesktopWindowTreeHostWin::HandleCancelMode() { | 754 void DesktopWindowTreeHostWin::HandleCancelMode() { |
| 756 dispatcher()->DispatchCancelModeEvent(); | 755 delegate_->OnHostCancelMode(); |
| 757 } | 756 } |
| 758 | 757 |
| 759 void DesktopWindowTreeHostWin::HandleCaptureLost() { | 758 void DesktopWindowTreeHostWin::HandleCaptureLost() { |
| 760 OnHostLostWindowCapture(); | 759 delegate_->OnHostLostWindowCapture(); |
| 761 native_widget_delegate_->OnMouseCaptureLost(); | 760 native_widget_delegate_->OnMouseCaptureLost(); |
| 762 } | 761 } |
| 763 | 762 |
| 764 void DesktopWindowTreeHostWin::HandleClose() { | 763 void DesktopWindowTreeHostWin::HandleClose() { |
| 765 GetWidget()->Close(); | 764 GetWidget()->Close(); |
| 766 } | 765 } |
| 767 | 766 |
| 768 bool DesktopWindowTreeHostWin::HandleCommand(int command) { | 767 bool DesktopWindowTreeHostWin::HandleCommand(int command) { |
| 769 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 768 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
| 770 } | 769 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { | 819 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { |
| 821 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); | 820 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
| 822 } | 821 } |
| 823 | 822 |
| 824 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { | 823 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { |
| 825 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 824 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 826 } | 825 } |
| 827 | 826 |
| 828 void DesktopWindowTreeHostWin::HandleClientSizeChanged( | 827 void DesktopWindowTreeHostWin::HandleClientSizeChanged( |
| 829 const gfx::Size& new_size) { | 828 const gfx::Size& new_size) { |
| 830 OnHostResized(new_size); | 829 if (delegate_) |
| 830 OnHostResized(new_size); |
| 831 } | 831 } |
| 832 | 832 |
| 833 void DesktopWindowTreeHostWin::HandleFrameChanged() { | 833 void DesktopWindowTreeHostWin::HandleFrameChanged() { |
| 834 SetWindowTransparency(); | 834 SetWindowTransparency(); |
| 835 // Replace the frame and layout the contents. | 835 // Replace the frame and layout the contents. |
| 836 GetWidget()->non_client_view()->UpdateFrame(); | 836 GetWidget()->non_client_view()->UpdateFrame(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { | 839 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { |
| 840 // TODO(beng): inform the native_widget_delegate_. | 840 // TODO(beng): inform the native_widget_delegate_. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1009 |
| 1010 // static | 1010 // static |
| 1011 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 1011 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 1012 internal::NativeWidgetDelegate* native_widget_delegate, | 1012 internal::NativeWidgetDelegate* native_widget_delegate, |
| 1013 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1013 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 1014 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1014 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 1015 desktop_native_widget_aura); | 1015 desktop_native_widget_aura); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } // namespace views | 1018 } // namespace views |
| OLD | NEW |