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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 void DesktopWindowTreeHostWin::Show() { | 443 void DesktopWindowTreeHostWin::Show() { |
444 message_handler_->Show(); | 444 message_handler_->Show(); |
445 } | 445 } |
446 | 446 |
447 void DesktopWindowTreeHostWin::Hide() { | 447 void DesktopWindowTreeHostWin::Hide() { |
448 if (!pending_close_) | 448 if (!pending_close_) |
449 message_handler_->Hide(); | 449 message_handler_->Hide(); |
450 } | 450 } |
451 | 451 |
452 void DesktopWindowTreeHostWin::ToggleFullScreen() { | |
453 SetWindowTransparency(); | |
454 } | |
455 | |
456 // GetBounds and SetBounds work in pixel coordinates, whereas other get/set | 452 // GetBounds and SetBounds work in pixel coordinates, whereas other get/set |
457 // methods work in DIP. | 453 // methods work in DIP. |
458 | 454 |
459 gfx::Rect DesktopWindowTreeHostWin::GetBounds() const { | 455 gfx::Rect DesktopWindowTreeHostWin::GetBounds() const { |
460 gfx::Rect bounds(message_handler_->GetClientAreaBounds()); | 456 gfx::Rect bounds(message_handler_->GetClientAreaBounds()); |
461 // If the window bounds were expanded we need to return the original bounds | 457 // If the window bounds were expanded we need to return the original bounds |
462 // To achieve this we do the reverse of the expansion, i.e. add the | 458 // To achieve this we do the reverse of the expansion, i.e. add the |
463 // window_expansion_top_left_delta_ to the origin and subtract the | 459 // window_expansion_top_left_delta_ to the origin and subtract the |
464 // window_expansion_bottom_right_delta_ from the width and height. | 460 // window_expansion_bottom_right_delta_ from the width and height. |
465 gfx::Rect without_expansion( | 461 gfx::Rect without_expansion( |
(...skipping 27 matching lines...) Expand all Loading... |
493 gfx::Vector2d(new_expanded.width() - expanded.width(), | 489 gfx::Vector2d(new_expanded.width() - expanded.width(), |
494 new_expanded.height() - expanded.height()); | 490 new_expanded.height() - expanded.height()); |
495 message_handler_->SetBounds(new_expanded); | 491 message_handler_->SetBounds(new_expanded); |
496 | 492 |
497 // The client area size may have changed even though the window bounds have | 493 // The client area size may have changed even though the window bounds have |
498 // not, if the window bounds were expanded to 64 pixels both times. | 494 // not, if the window bounds were expanded to 64 pixels both times. |
499 if (old_hwnd_size == new_expanded.size() && old_content_size != bounds.size()) | 495 if (old_hwnd_size == new_expanded.size() && old_content_size != bounds.size()) |
500 HandleClientSizeChanged(new_expanded.size()); | 496 HandleClientSizeChanged(new_expanded.size()); |
501 } | 497 } |
502 | 498 |
503 gfx::Insets DesktopWindowTreeHostWin::GetInsets() const { | |
504 return gfx::Insets(); | |
505 } | |
506 | |
507 void DesktopWindowTreeHostWin::SetInsets(const gfx::Insets& insets) { | |
508 } | |
509 | |
510 gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const { | 499 gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const { |
511 return GetBounds().origin(); | 500 return GetBounds().origin(); |
512 } | 501 } |
513 | 502 |
514 void DesktopWindowTreeHostWin::SetCapture() { | 503 void DesktopWindowTreeHostWin::SetCapture() { |
515 message_handler_->SetCapture(); | 504 message_handler_->SetCapture(); |
516 } | 505 } |
517 | 506 |
518 void DesktopWindowTreeHostWin::ReleaseCapture() { | 507 void DesktopWindowTreeHostWin::ReleaseCapture() { |
519 message_handler_->ReleaseCapture(); | 508 message_handler_->ReleaseCapture(); |
520 } | 509 } |
521 | 510 |
522 bool DesktopWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { | 511 bool DesktopWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { |
523 aura::client::CursorClient* cursor_client = | 512 aura::client::CursorClient* cursor_client = |
524 aura::client::GetCursorClient(window()); | 513 aura::client::GetCursorClient(window()); |
525 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | 514 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { |
526 *location_return = gfx::Point(0, 0); | 515 *location_return = gfx::Point(0, 0); |
527 return false; | 516 return false; |
528 } | 517 } |
529 POINT pt = {0}; | 518 POINT pt = {0}; |
530 ::GetCursorPos(&pt); | 519 ::GetCursorPos(&pt); |
531 *location_return = | 520 *location_return = |
532 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); | 521 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); |
533 return true; | 522 return true; |
534 } | 523 } |
535 | 524 |
536 bool DesktopWindowTreeHostWin::ConfineCursorToRootWindow() { | |
537 RECT window_rect = window()->GetBoundsInScreen().ToRECT(); | |
538 ::ClipCursor(&window_rect); | |
539 return true; | |
540 } | |
541 | |
542 void DesktopWindowTreeHostWin::UnConfineCursor() { | |
543 ::ClipCursor(NULL); | |
544 } | |
545 | |
546 void DesktopWindowTreeHostWin::PostNativeEvent( | 525 void DesktopWindowTreeHostWin::PostNativeEvent( |
547 const base::NativeEvent& native_event) { | 526 const base::NativeEvent& native_event) { |
548 } | 527 } |
549 | 528 |
550 void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged( | 529 void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged( |
551 float device_scale_factor) { | 530 float device_scale_factor) { |
552 } | 531 } |
553 | 532 |
554 void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { | 533 void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { |
555 ui::CursorLoaderWin cursor_loader; | 534 ui::CursorLoaderWin cursor_loader; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 977 |
999 // static | 978 // static |
1000 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 979 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
1001 internal::NativeWidgetDelegate* native_widget_delegate, | 980 internal::NativeWidgetDelegate* native_widget_delegate, |
1002 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 981 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
1003 return new DesktopWindowTreeHostWin(native_widget_delegate, | 982 return new DesktopWindowTreeHostWin(native_widget_delegate, |
1004 desktop_native_widget_aura); | 983 desktop_native_widget_aura); |
1005 } | 984 } |
1006 | 985 |
1007 } // namespace views | 986 } // namespace views |
OLD | NEW |