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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 gfx::Rect new_expanded( | 538 gfx::Rect new_expanded( |
539 expanded.origin(), | 539 expanded.origin(), |
540 GetExpandedWindowSize(message_handler_->window_ex_style(), | 540 GetExpandedWindowSize(message_handler_->window_ex_style(), |
541 expanded.size())); | 541 expanded.size())); |
542 window_enlargement_ = | 542 window_enlargement_ = |
543 gfx::Vector2d(new_expanded.width() - expanded.width(), | 543 gfx::Vector2d(new_expanded.width() - expanded.width(), |
544 new_expanded.height() - expanded.height()); | 544 new_expanded.height() - expanded.height()); |
545 message_handler_->SetBounds(new_expanded, old_content_size != bounds.size()); | 545 message_handler_->SetBounds(new_expanded, old_content_size != bounds.size()); |
546 } | 546 } |
547 | 547 |
548 gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const { | 548 gfx::Point DesktopWindowTreeHostWin::GetLocationOnScreenInPixels() const { |
549 return GetBoundsInPixels().origin(); | 549 return GetBoundsInPixels().origin(); |
550 } | 550 } |
551 | 551 |
552 void DesktopWindowTreeHostWin::SetCapture() { | 552 void DesktopWindowTreeHostWin::SetCapture() { |
553 message_handler_->SetCapture(); | 553 message_handler_->SetCapture(); |
554 } | 554 } |
555 | 555 |
556 void DesktopWindowTreeHostWin::ReleaseCapture() { | 556 void DesktopWindowTreeHostWin::ReleaseCapture() { |
557 message_handler_->ReleaseCapture(); | 557 message_handler_->ReleaseCapture(); |
558 } | 558 } |
559 | 559 |
560 void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { | 560 void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { |
561 ui::CursorLoaderWin cursor_loader; | 561 ui::CursorLoaderWin cursor_loader; |
562 cursor_loader.SetPlatformCursor(&cursor); | 562 cursor_loader.SetPlatformCursor(&cursor); |
563 | 563 |
564 message_handler_->SetCursor(cursor.platform()); | 564 message_handler_->SetCursor(cursor.platform()); |
565 } | 565 } |
566 | 566 |
567 void DesktopWindowTreeHostWin::OnCursorVisibilityChangedNative(bool show) { | 567 void DesktopWindowTreeHostWin::OnCursorVisibilityChangedNative(bool show) { |
568 if (is_cursor_visible_ == show) | 568 if (is_cursor_visible_ == show) |
569 return; | 569 return; |
570 is_cursor_visible_ = show; | 570 is_cursor_visible_ = show; |
571 ::ShowCursor(!!show); | 571 ::ShowCursor(!!show); |
572 } | 572 } |
573 | 573 |
574 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { | 574 void DesktopWindowTreeHostWin::MoveCursorToScreenLocationInPixels( |
575 POINT cursor_location = location.ToPOINT(); | 575 const gfx::Point& location_in_pixels) { |
| 576 POINT cursor_location = location_in_pixels.ToPOINT(); |
576 ::ClientToScreen(GetHWND(), &cursor_location); | 577 ::ClientToScreen(GetHWND(), &cursor_location); |
577 ::SetCursorPos(cursor_location.x, cursor_location.y); | 578 ::SetCursorPos(cursor_location.x, cursor_location.y); |
578 } | 579 } |
579 | 580 |
580 //////////////////////////////////////////////////////////////////////////////// | 581 //////////////////////////////////////////////////////////////////////////////// |
581 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: | 582 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: |
582 | 583 |
583 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( | 584 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( |
584 const gfx::Vector2d& top_left_delta, | 585 const gfx::Vector2d& top_left_delta, |
585 const gfx::Vector2d& bottom_right_delta) { | 586 const gfx::Vector2d& bottom_right_delta) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() { | 787 void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() { |
787 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); | 788 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); |
788 } | 789 } |
789 | 790 |
790 void DesktopWindowTreeHostWin::HandleEndWMSizeMove() { | 791 void DesktopWindowTreeHostWin::HandleEndWMSizeMove() { |
791 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); | 792 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); |
792 } | 793 } |
793 | 794 |
794 void DesktopWindowTreeHostWin::HandleMove() { | 795 void DesktopWindowTreeHostWin::HandleMove() { |
795 native_widget_delegate_->OnNativeWidgetMove(); | 796 native_widget_delegate_->OnNativeWidgetMove(); |
796 OnHostMoved(GetBoundsInPixels().origin()); | 797 OnHostMovedInPixels(GetBoundsInPixels().origin()); |
797 } | 798 } |
798 | 799 |
799 void DesktopWindowTreeHostWin::HandleWorkAreaChanged() { | 800 void DesktopWindowTreeHostWin::HandleWorkAreaChanged() { |
800 GetWidget()->widget_delegate()->OnWorkAreaChanged(); | 801 GetWidget()->widget_delegate()->OnWorkAreaChanged(); |
801 } | 802 } |
802 | 803 |
803 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { | 804 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { |
804 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); | 805 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
805 } | 806 } |
806 | 807 |
807 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { | 808 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { |
808 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 809 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
809 } | 810 } |
810 | 811 |
811 void DesktopWindowTreeHostWin::HandleClientSizeChanged( | 812 void DesktopWindowTreeHostWin::HandleClientSizeChanged( |
812 const gfx::Size& new_size) { | 813 const gfx::Size& new_size) { |
813 if (dispatcher()) | 814 if (dispatcher()) |
814 OnHostResized(new_size); | 815 OnHostResizedInPixels(new_size); |
815 } | 816 } |
816 | 817 |
817 void DesktopWindowTreeHostWin::HandleFrameChanged() { | 818 void DesktopWindowTreeHostWin::HandleFrameChanged() { |
818 SetWindowTransparency(); | 819 SetWindowTransparency(); |
819 // Replace the frame and layout the contents. | 820 // Replace the frame and layout the contents. |
820 GetWidget()->non_client_view()->UpdateFrame(); | 821 GetWidget()->non_client_view()->UpdateFrame(); |
821 } | 822 } |
822 | 823 |
823 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { | 824 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { |
824 // TODO(beng): inform the native_widget_delegate_. | 825 // TODO(beng): inform the native_widget_delegate_. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 994 |
994 // static | 995 // static |
995 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 996 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
996 internal::NativeWidgetDelegate* native_widget_delegate, | 997 internal::NativeWidgetDelegate* native_widget_delegate, |
997 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 998 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
998 return new DesktopWindowTreeHostWin(native_widget_delegate, | 999 return new DesktopWindowTreeHostWin(native_widget_delegate, |
999 desktop_native_widget_aura); | 1000 desktop_native_widget_aura); |
1000 } | 1001 } |
1001 | 1002 |
1002 } // namespace views | 1003 } // namespace views |
OLD | NEW |