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 <oleacc.h> | 8 #include <oleacc.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 | 10 |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 } | 841 } |
842 if (delegate_->CanMinimize()) { | 842 if (delegate_->CanMinimize()) { |
843 style |= WS_MINIMIZEBOX; | 843 style |= WS_MINIMIZEBOX; |
844 } else { | 844 } else { |
845 style &= ~WS_MINIMIZEBOX; | 845 style &= ~WS_MINIMIZEBOX; |
846 } | 846 } |
847 SetWindowLong(hwnd(), GWL_STYLE, style); | 847 SetWindowLong(hwnd(), GWL_STYLE, style); |
848 } | 848 } |
849 | 849 |
850 //////////////////////////////////////////////////////////////////////////////// | 850 //////////////////////////////////////////////////////////////////////////////// |
851 // HWNDMessageHandler, InputMethodDelegate implementation: | |
852 | |
853 void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) { | |
854 SetMsgHandled(delegate_->HandleKeyEvent(key)); | |
855 } | |
856 | |
857 //////////////////////////////////////////////////////////////////////////////// | |
858 // HWNDMessageHandler, gfx::WindowImpl overrides: | 851 // HWNDMessageHandler, gfx::WindowImpl overrides: |
859 | 852 |
860 HICON HWNDMessageHandler::GetDefaultWindowIcon() const { | 853 HICON HWNDMessageHandler::GetDefaultWindowIcon() const { |
861 if (use_system_default_icon_) | 854 if (use_system_default_icon_) |
862 return nullptr; | 855 return nullptr; |
863 return ViewsDelegate::GetInstance() | 856 return ViewsDelegate::GetInstance() |
864 ? ViewsDelegate::GetInstance()->GetDefaultWindowIcon() | 857 ? ViewsDelegate::GetInstance()->GetDefaultWindowIcon() |
865 : nullptr; | 858 : nullptr; |
866 } | 859 } |
867 | 860 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 LPARAM l_param) { | 1609 LPARAM l_param) { |
1617 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. | 1610 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
1618 tracked_objects::ScopedTracker tracking_profile( | 1611 tracked_objects::ScopedTracker tracking_profile( |
1619 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1612 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
1620 "440919 HWNDMessageHandler::OnKeyEvent")); | 1613 "440919 HWNDMessageHandler::OnKeyEvent")); |
1621 | 1614 |
1622 MSG msg = { | 1615 MSG msg = { |
1623 hwnd(), message, w_param, l_param, static_cast<DWORD>(GetMessageTime())}; | 1616 hwnd(), message, w_param, l_param, static_cast<DWORD>(GetMessageTime())}; |
1624 ui::KeyEvent key(msg); | 1617 ui::KeyEvent key(msg); |
1625 if (!delegate_->HandleUntranslatedKeyEvent(key)) | 1618 if (!delegate_->HandleUntranslatedKeyEvent(key)) |
1626 DispatchKeyEventPostIME(key); | 1619 SetMsgHandled(FALSE); |
1627 return 0; | 1620 return 0; |
1628 } | 1621 } |
1629 | 1622 |
1630 void HWNDMessageHandler::OnKillFocus(HWND focused_window) { | 1623 void HWNDMessageHandler::OnKillFocus(HWND focused_window) { |
1631 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. | 1624 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
1632 tracked_objects::ScopedTracker tracking_profile( | 1625 tracked_objects::ScopedTracker tracking_profile( |
1633 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1626 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
1634 "440919 HWNDMessageHandler::OnKillFocus")); | 1627 "440919 HWNDMessageHandler::OnKillFocus")); |
1635 | 1628 |
1636 delegate_->HandleNativeBlur(focused_window); | 1629 delegate_->HandleNativeBlur(focused_window); |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2738 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
2746 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2739 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
2747 } | 2740 } |
2748 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2741 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
2749 // to notify our children too, since we can have MDI child windows who need to | 2742 // to notify our children too, since we can have MDI child windows who need to |
2750 // update their appearance. | 2743 // update their appearance. |
2751 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2744 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
2752 } | 2745 } |
2753 | 2746 |
2754 } // namespace views | 2747 } // namespace views |
OLD | NEW |