| 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/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 void HWNDMessageHandler::ClearNativeFocus() { | 713 void HWNDMessageHandler::ClearNativeFocus() { |
| 714 ::SetFocus(hwnd()); | 714 ::SetFocus(hwnd()); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void HWNDMessageHandler::SetCapture() { | 717 void HWNDMessageHandler::SetCapture() { |
| 718 DCHECK(!HasCapture()); | 718 DCHECK(!HasCapture()); |
| 719 ::SetCapture(hwnd()); | 719 ::SetCapture(hwnd()); |
| 720 } | 720 } |
| 721 | 721 |
| 722 void HWNDMessageHandler::ReleaseCapture() { | 722 void HWNDMessageHandler::ReleaseCapture() { |
| 723 ::ReleaseCapture(); | 723 if (HasCapture()) |
| 724 ::ReleaseCapture(); |
| 724 } | 725 } |
| 725 | 726 |
| 726 bool HWNDMessageHandler::HasCapture() const { | 727 bool HWNDMessageHandler::HasCapture() const { |
| 727 return ::GetCapture() == hwnd(); | 728 return ::GetCapture() == hwnd(); |
| 728 } | 729 } |
| 729 | 730 |
| 730 void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) { | 731 void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) { |
| 731 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 732 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 732 int dwm_value = enabled ? FALSE : TRUE; | 733 int dwm_value = enabled ? FALSE : TRUE; |
| 733 DwmSetWindowAttribute( | 734 DwmSetWindowAttribute( |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 DwmExtendFrameIntoClientArea(hwnd(), &m); | 2108 DwmExtendFrameIntoClientArea(hwnd(), &m); |
| 2108 } | 2109 } |
| 2109 if (window_pos->flags & SWP_SHOWWINDOW) | 2110 if (window_pos->flags & SWP_SHOWWINDOW) |
| 2110 delegate_->HandleVisibilityChanged(true); | 2111 delegate_->HandleVisibilityChanged(true); |
| 2111 else if (window_pos->flags & SWP_HIDEWINDOW) | 2112 else if (window_pos->flags & SWP_HIDEWINDOW) |
| 2112 delegate_->HandleVisibilityChanged(false); | 2113 delegate_->HandleVisibilityChanged(false); |
| 2113 SetMsgHandled(FALSE); | 2114 SetMsgHandled(FALSE); |
| 2114 } | 2115 } |
| 2115 | 2116 |
| 2116 } // namespace views | 2117 } // namespace views |
| OLD | NEW |