| 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 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // So we need to handle these messages in CustomFrameWindow to prevent this | 56 // So we need to handle these messages in CustomFrameWindow to prevent this |
| 57 // from happening. | 57 // from happening. |
| 58 const int WM_NCUAHDRAWCAPTION = 0xAE; | 58 const int WM_NCUAHDRAWCAPTION = 0xAE; |
| 59 const int WM_NCUAHDRAWFRAME = 0xAF; | 59 const int WM_NCUAHDRAWFRAME = 0xAF; |
| 60 | 60 |
| 61 // The HWNDMessageHandler sends this message to itself on | 61 // The HWNDMessageHandler sends this message to itself on |
| 62 // WM_WINDOWPOSCHANGING. It's used to inform the client if a | 62 // WM_WINDOWPOSCHANGING. It's used to inform the client if a |
| 63 // WM_WINDOWPOSCHANGED won't be received. | 63 // WM_WINDOWPOSCHANGED won't be received. |
| 64 const int WM_WINDOWSIZINGFINISHED = WM_USER; | 64 const int WM_WINDOWSIZINGFINISHED = WM_USER; |
| 65 | 65 |
| 66 // Message used by the shell to send us notification messages related to the |
| 67 // taskbar. |
| 68 const int WM_APPBAR_NOTIFICATION_MESSAGE = WM_APP + 1; |
| 69 |
| 66 // IsMsgHandled() and BEGIN_SAFE_MSG_MAP_EX are a modified version of | 70 // IsMsgHandled() and BEGIN_SAFE_MSG_MAP_EX are a modified version of |
| 67 // BEGIN_MSG_MAP_EX. The main difference is it uses a WeakPtrFactory member | 71 // BEGIN_MSG_MAP_EX. The main difference is it uses a WeakPtrFactory member |
| 68 // (|weak_factory|) that is used in _ProcessWindowMessage() and changing | 72 // (|weak_factory|) that is used in _ProcessWindowMessage() and changing |
| 69 // IsMsgHandled() from a member function to a define that checks if the weak | 73 // IsMsgHandled() from a member function to a define that checks if the weak |
| 70 // factory is still valid in addition to the member. Together these allow for | 74 // factory is still valid in addition to the member. Together these allow for |
| 71 // |this| to be deleted during dispatch. | 75 // |this| to be deleted during dispatch. |
| 72 #define IsMsgHandled() !ref.get() || msg_handled_ | 76 #define IsMsgHandled() !ref.get() || msg_handled_ |
| 73 | 77 |
| 74 #define BEGIN_SAFE_MSG_MAP_EX(weak_factory) \ | 78 #define BEGIN_SAFE_MSG_MAP_EX(weak_factory) \ |
| 75 private: \ | 79 private: \ |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 CR_MSG_WM_PAINT(OnPaint) | 421 CR_MSG_WM_PAINT(OnPaint) |
| 418 CR_MSG_WM_SETFOCUS(OnSetFocus) | 422 CR_MSG_WM_SETFOCUS(OnSetFocus) |
| 419 CR_MSG_WM_SETICON(OnSetIcon) | 423 CR_MSG_WM_SETICON(OnSetIcon) |
| 420 CR_MSG_WM_SETTEXT(OnSetText) | 424 CR_MSG_WM_SETTEXT(OnSetText) |
| 421 CR_MSG_WM_SETTINGCHANGE(OnSettingChange) | 425 CR_MSG_WM_SETTINGCHANGE(OnSettingChange) |
| 422 CR_MSG_WM_SIZE(OnSize) | 426 CR_MSG_WM_SIZE(OnSize) |
| 423 CR_MSG_WM_SYSCOMMAND(OnSysCommand) | 427 CR_MSG_WM_SYSCOMMAND(OnSysCommand) |
| 424 CR_MSG_WM_THEMECHANGED(OnThemeChanged) | 428 CR_MSG_WM_THEMECHANGED(OnThemeChanged) |
| 425 CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) | 429 CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) |
| 426 CR_MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging) | 430 CR_MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging) |
| 431 CR_MESSAGE_HANDLER_EX(WM_APPBAR_NOTIFICATION_MESSAGE, OnAppBarMessage) |
| 427 CR_END_MSG_MAP() | 432 CR_END_MSG_MAP() |
| 428 | 433 |
| 429 // Message Handlers. | 434 // Message Handlers. |
| 430 // This list is in _ALPHABETICAL_ order! | 435 // This list is in _ALPHABETICAL_ order! |
| 431 // TODO(beng): Once this object becomes the WindowImpl, these methods can | 436 // TODO(beng): Once this object becomes the WindowImpl, these methods can |
| 432 // be made private. | 437 // be made private. |
| 433 void OnActivateApp(BOOL active, DWORD thread_id); | 438 void OnActivateApp(BOOL active, DWORD thread_id); |
| 434 // TODO(beng): return BOOL is temporary until this object becomes a | 439 // TODO(beng): return BOOL is temporary until this object becomes a |
| 435 // WindowImpl. | 440 // WindowImpl. |
| 436 BOOL OnAppCommand(HWND window, short command, WORD device, int keystate); | 441 BOOL OnAppCommand(HWND window, short command, WORD device, int keystate); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 LRESULT OnSetIcon(UINT size_type, HICON new_icon); | 480 LRESULT OnSetIcon(UINT size_type, HICON new_icon); |
| 476 LRESULT OnSetText(const wchar_t* text); | 481 LRESULT OnSetText(const wchar_t* text); |
| 477 void OnSettingChange(UINT flags, const wchar_t* section); | 482 void OnSettingChange(UINT flags, const wchar_t* section); |
| 478 void OnSize(UINT param, const gfx::Size& size); | 483 void OnSize(UINT param, const gfx::Size& size); |
| 479 void OnSysCommand(UINT notification_code, const gfx::Point& point); | 484 void OnSysCommand(UINT notification_code, const gfx::Point& point); |
| 480 void OnThemeChanged(); | 485 void OnThemeChanged(); |
| 481 LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param); | 486 LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param); |
| 482 void OnWindowPosChanging(WINDOWPOS* window_pos); | 487 void OnWindowPosChanging(WINDOWPOS* window_pos); |
| 483 void OnWindowPosChanged(WINDOWPOS* window_pos); | 488 void OnWindowPosChanged(WINDOWPOS* window_pos); |
| 484 LRESULT OnWindowSizingFinished(UINT message, WPARAM w_param, LPARAM l_param); | 489 LRESULT OnWindowSizingFinished(UINT message, WPARAM w_param, LPARAM l_param); |
| 490 LRESULT OnAppBarMessage(UINT message, WPARAM w_param, LPARAM l_param); |
| 485 | 491 |
| 486 // Receives Windows Session Change notifications. | 492 // Receives Windows Session Change notifications. |
| 487 void OnSessionChange(WPARAM status_code); | 493 void OnSessionChange(WPARAM status_code); |
| 488 | 494 |
| 489 typedef std::vector<ui::TouchEvent> TouchEvents; | 495 typedef std::vector<ui::TouchEvent> TouchEvents; |
| 490 // Helper to handle the list of touch events passed in. We need this because | 496 // Helper to handle the list of touch events passed in. We need this because |
| 491 // touch events on windows don't fire if we enter a modal loop in the context | 497 // touch events on windows don't fire if we enter a modal loop in the context |
| 492 // of a touch event. | 498 // of a touch event. |
| 493 void HandleTouchEvents(const TouchEvents& touch_events); | 499 void HandleTouchEvents(const TouchEvents& touch_events); |
| 494 | 500 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 706 |
| 701 // The factory used with BEGIN_SAFE_MSG_MAP_EX. | 707 // The factory used with BEGIN_SAFE_MSG_MAP_EX. |
| 702 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; | 708 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
| 703 | 709 |
| 704 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); | 710 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
| 705 }; | 711 }; |
| 706 | 712 |
| 707 } // namespace views | 713 } // namespace views |
| 708 | 714 |
| 709 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 715 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| OLD | NEW |