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> |
| 11 #include <map> |
11 #include <memory> | 12 #include <memory> |
12 #include <set> | 13 #include <set> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/lazy_instance.h" |
16 #include "base/macros.h" | 18 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
18 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
19 #include "base/win/scoped_gdi_object.h" | 21 #include "base/win/scoped_gdi_object.h" |
20 #include "base/win/win_util.h" | 22 #include "base/win/win_util.h" |
21 #include "ui/accessibility/ax_enums.h" | 23 #include "ui/accessibility/ax_enums.h" |
22 #include "ui/base/ui_base_types.h" | 24 #include "ui/base/ui_base_types.h" |
23 #include "ui/base/win/window_event_target.h" | 25 #include "ui/base/win/window_event_target.h" |
24 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
25 #include "ui/gfx/geometry/rect.h" | 27 #include "ui/gfx/geometry/rect.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // Returns true if the message was handled. | 512 // Returns true if the message was handled. |
511 bool HandleMouseInputForCaption(unsigned int message, | 513 bool HandleMouseInputForCaption(unsigned int message, |
512 WPARAM w_param, | 514 WPARAM w_param, |
513 LPARAM l_param); | 515 LPARAM l_param); |
514 | 516 |
515 // Helper function for setting the bounds of the HWND. For more information | 517 // Helper function for setting the bounds of the HWND. For more information |
516 // please refer to the SetBounds() function. | 518 // please refer to the SetBounds() function. |
517 void SetBoundsInternal(const gfx::Rect& bounds_in_pixels, | 519 void SetBoundsInternal(const gfx::Rect& bounds_in_pixels, |
518 bool force_size_changed); | 520 bool force_size_changed); |
519 | 521 |
| 522 // Checks if there is a full screen window on the same monitor as the |
| 523 // |window| which is becoming active. If yes then we reduce the size of the |
| 524 // fullscreen window by 1 px to ensure that maximized windows on the same |
| 525 // monitor don't draw over the taskbar. |
| 526 void CheckAndHandleBackgroundFullscreenOnMonitor(HWND window); |
| 527 |
| 528 // Provides functionality to reduce the bounds of the fullscreen window by 1 |
| 529 // px on activation loss to a window on the same monitor. |
| 530 void OnBackgroundFullscreen(); |
| 531 |
520 HWNDMessageHandlerDelegate* delegate_; | 532 HWNDMessageHandlerDelegate* delegate_; |
521 | 533 |
522 std::unique_ptr<FullscreenHandler> fullscreen_handler_; | 534 std::unique_ptr<FullscreenHandler> fullscreen_handler_; |
523 | 535 |
524 // Set to true in Close() and false is CloseNow(). | 536 // Set to true in Close() and false is CloseNow(). |
525 bool waiting_for_close_now_; | 537 bool waiting_for_close_now_; |
526 | 538 |
527 bool use_system_default_icon_; | 539 bool use_system_default_icon_; |
528 | 540 |
529 // Whether all ancestors have been enabled. This is only used if is_modal_ is | 541 // Whether all ancestors have been enabled. This is only used if is_modal_ is |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 gfx::Point caption_left_button_click_pos_; | 656 gfx::Point caption_left_button_click_pos_; |
645 | 657 |
646 // Set to true if the left mouse button has been pressed on the caption. | 658 // Set to true if the left mouse button has been pressed on the caption. |
647 // Defaults to false. | 659 // Defaults to false. |
648 bool left_button_down_on_caption_; | 660 bool left_button_down_on_caption_; |
649 | 661 |
650 // Set to true if the window is a background fullscreen window, i.e a | 662 // Set to true if the window is a background fullscreen window, i.e a |
651 // fullscreen window which lost activation. Defaults to false. | 663 // fullscreen window which lost activation. Defaults to false. |
652 bool background_fullscreen_hack_; | 664 bool background_fullscreen_hack_; |
653 | 665 |
| 666 // This is a map of the HMONITOR to full screeen window instance. It is safe |
| 667 // to keep a raw pointer to the HWNDMessageHandler instance as we track the |
| 668 // window destruction and ensure that the map is cleaned up. |
| 669 using FullscreenWindowMonitorMap = std::map<HMONITOR, HWNDMessageHandler*>; |
| 670 static base::LazyInstance<FullscreenWindowMonitorMap> fullscreen_monitor_map_; |
| 671 |
654 // The WeakPtrFactories below must occur last in the class definition so they | 672 // The WeakPtrFactories below must occur last in the class definition so they |
655 // get destroyed last. | 673 // get destroyed last. |
656 | 674 |
657 // The factory used to lookup appbar autohide edges. | 675 // The factory used to lookup appbar autohide edges. |
658 base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_; | 676 base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_; |
659 | 677 |
660 // The factory used with BEGIN_SAFE_MSG_MAP_EX. | 678 // The factory used with BEGIN_SAFE_MSG_MAP_EX. |
661 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; | 679 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
662 | 680 |
663 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); | 681 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
664 }; | 682 }; |
665 | 683 |
666 } // namespace views | 684 } // namespace views |
667 | 685 |
668 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 686 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
OLD | NEW |