| 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 #include <wtsapi32.h> | 9 #include <wtsapi32.h> |
| 10 #pragma comment(lib, "wtsapi32.lib") | 10 #pragma comment(lib, "wtsapi32.lib") |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 fwi.dwFlags = FLASHW_STOP; | 781 fwi.dwFlags = FLASHW_STOP; |
| 782 } | 782 } |
| 783 FlashWindowEx(&fwi); | 783 FlashWindowEx(&fwi); |
| 784 } | 784 } |
| 785 | 785 |
| 786 void HWNDMessageHandler::ClearNativeFocus() { | 786 void HWNDMessageHandler::ClearNativeFocus() { |
| 787 ::SetFocus(hwnd()); | 787 ::SetFocus(hwnd()); |
| 788 } | 788 } |
| 789 | 789 |
| 790 void HWNDMessageHandler::SetCapture() { | 790 void HWNDMessageHandler::SetCapture() { |
| 791 DCHECK(!HasCapture()); | 791 // DCHECK(!HasCapture()); |
| 792 ::SetCapture(hwnd()); | 792 ::SetCapture(hwnd()); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void HWNDMessageHandler::ReleaseCapture() { | 795 void HWNDMessageHandler::ReleaseCapture() { |
| 796 if (HasCapture()) | 796 if (HasCapture()) |
| 797 ::ReleaseCapture(); | 797 ::ReleaseCapture(); |
| 798 } | 798 } |
| 799 | 799 |
| 800 bool HWNDMessageHandler::HasCapture() const { | 800 bool HWNDMessageHandler::HasCapture() const { |
| 801 return ::GetCapture() == hwnd(); | 801 return ::GetCapture() == hwnd(); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 return handled; | 1326 return handled; |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 void HWNDMessageHandler::OnCancelMode() { | 1329 void HWNDMessageHandler::OnCancelMode() { |
| 1330 delegate_->HandleCancelMode(); | 1330 delegate_->HandleCancelMode(); |
| 1331 // Need default handling, otherwise capture and other things aren't canceled. | 1331 // Need default handling, otherwise capture and other things aren't canceled. |
| 1332 SetMsgHandled(FALSE); | 1332 SetMsgHandled(FALSE); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 void HWNDMessageHandler::OnCaptureChanged(HWND window) { | 1335 void HWNDMessageHandler::OnCaptureChanged(HWND window) { |
| 1336 delegate_->HandleCaptureLost(); | 1336 if (!HasCapture()) |
| 1337 delegate_->HandleCaptureLost(); |
| 1337 } | 1338 } |
| 1338 | 1339 |
| 1339 void HWNDMessageHandler::OnClose() { | 1340 void HWNDMessageHandler::OnClose() { |
| 1340 delegate_->HandleClose(); | 1341 delegate_->HandleClose(); |
| 1341 } | 1342 } |
| 1342 | 1343 |
| 1343 void HWNDMessageHandler::OnCommand(UINT notification_code, | 1344 void HWNDMessageHandler::OnCommand(UINT notification_code, |
| 1344 int command, | 1345 int command, |
| 1345 HWND window) { | 1346 HWND window) { |
| 1346 // If the notification code is > 1 it means it is control specific and we | 1347 // If the notification code is > 1 it means it is control specific and we |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 SetMsgHandled(FALSE); | 2422 SetMsgHandled(FALSE); |
| 2422 } | 2423 } |
| 2423 | 2424 |
| 2424 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { | 2425 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { |
| 2425 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); | 2426 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); |
| 2426 for (size_t i = 0; i < touch_events.size() && ref; ++i) | 2427 for (size_t i = 0; i < touch_events.size() && ref; ++i) |
| 2427 delegate_->HandleTouchEvent(touch_events[i]); | 2428 delegate_->HandleTouchEvent(touch_events[i]); |
| 2428 } | 2429 } |
| 2429 | 2430 |
| 2430 } // namespace views | 2431 } // namespace views |
| OLD | NEW |