Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1662)

Unified Diff: components/mus/ws/event_dispatcher.h

Issue 1818333002: Reland: mus: Enable system modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased after fixing the crash Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/BUILD.gn ('k') | components/mus/ws/event_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/event_dispatcher.h
diff --git a/components/mus/ws/event_dispatcher.h b/components/mus/ws/event_dispatcher.h
index 19b39b2bc314d2a98e5316d461a87350ac4be930..d9e41ae4d4c8ff5431988e250eb338ff231dd0eb 100644
--- a/components/mus/ws/event_dispatcher.h
+++ b/components/mus/ws/event_dispatcher.h
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "cc/surfaces/surface_id.h"
#include "components/mus/public/interfaces/event_matcher.mojom.h"
+#include "components/mus/ws/modal_window_controller.h"
#include "components/mus/ws/server_window_observer.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -60,6 +61,20 @@ class EventDispatcher : public ServerWindowObserver {
// (indicated by returning |false|).
bool SetCaptureWindow(ServerWindow* capture_window, bool in_nonclient_area);
+ // Adds a system modal window. The window remains modal to system until it is
+ // destroyed. There can exist multiple system modal windows, in which case the
+ // one that is visible and added most recently or shown most recently would be
+ // the active one.
+ void AddSystemModalWindow(ServerWindow* window);
+
+ // Checks if |modal_window| is a visible modal window that blocks current
+ // capture window and if that's the case, releases the capture.
+ void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
+
+ // Checks if the current capture window is blocked by any visible modal window
+ // and if that's the case, releases the capture.
+ void ReleaseCaptureBlockedByAnyModalWindow();
+
// Retrieves the ServerWindow of the last mouse move.
ServerWindow* mouse_cursor_source_window() const {
return mouse_cursor_source_window_;
@@ -148,9 +163,11 @@ class EventDispatcher : public ServerWindowObserver {
// way we continue to eat events until the up/cancel is received.
void CancelPointerEventsToTarget(ServerWindow* window);
- // Returns true if we're currently an observer for |window|. We are an
- // observer for a window if any pointer events are targeting it.
- bool IsObservingWindow(ServerWindow* window);
+ // Used to observe a window. Can be called multiple times on a window. To
+ // unobserve a window, UnobserveWindow() should be called the same number of
+ // times.
+ void ObserveWindow(ServerWindow* winodw);
+ void UnobserveWindow(ServerWindow* winodw);
// Returns an Accelerator bound to the specified code/flags, and of the
// matching |phase|. Otherwise returns null.
@@ -166,9 +183,12 @@ class EventDispatcher : public ServerWindowObserver {
EventDispatcherDelegate* delegate_;
ServerWindow* root_;
- ServerWindow* capture_window_;
+ ServerWindow* capture_window_;
bool capture_window_in_nonclient_area_;
+
+ ModalWindowController modal_window_controller_;
+
bool mouse_button_down_;
ServerWindow* mouse_cursor_source_window_;
@@ -188,6 +208,9 @@ class EventDispatcher : public ServerWindowObserver {
// cancel or up.
PointerIdToTargetMap pointer_targets_;
+ // Keeps track of number of observe requests for each observed window.
+ std::map<const ServerWindow*, uint8_t> observed_windows_;
+
DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
};
« no previous file with comments | « components/mus/ws/BUILD.gn ('k') | components/mus/ws/event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698