| 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_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
| 6 #define UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 6 #define UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/aura/env_observer.h" | 12 #include "ui/aura/env_observer.h" |
| 13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 14 #include "ui/events/event_handler.h" | 14 #include "ui/events/event_handler.h" |
| 15 #include "ui/wm/wm_export.h" | 15 #include "ui/wm/wm_export.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class EventTarget; | 18 class EventTarget; |
| 19 class LocatedEvent; | 19 class LocatedEvent; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace wm { | 22 namespace wm { |
| 23 | 23 |
| 24 // Key for native window proprety that indicates if the window (should be |
| 25 // ui::MODAL_TYPE_WINDOW) is top level with a transient parent and allows |
| 26 // events to be sent to the transient parent. Otherwise, window modal |
| 27 // transients will absorb all events sent to the transient parent. |
| 28 WM_EXPORT extern const char kAllowTransientParentEventsKey[]; |
| 29 |
| 24 // Sets the modal parent for the child. | 30 // Sets the modal parent for the child. |
| 25 WM_EXPORT void SetModalParent(aura::Window* child, aura::Window* parent); | 31 WM_EXPORT void SetModalParent(aura::Window* child, aura::Window* parent); |
| 26 | 32 |
| 27 // Returns the modal transient child of |window|, or NULL if |window| does not | 33 // Returns the modal transient child of |window|, or NULL if |window| does not |
| 28 // have any modal transient children. | 34 // have any modal transient children or if the children do not block the parent |
| 35 // window. |
| 29 WM_EXPORT aura::Window* GetModalTransient(aura::Window* window); | 36 WM_EXPORT aura::Window* GetModalTransient(aura::Window* window); |
| 30 | 37 |
| 38 // Returns the modal transient of |window| including window modal transients |
| 39 // that do not block the parent window. |
| 40 WM_EXPORT aura::Window* HasWindowModalTransient(aura::Window * window); |
| 41 |
| 31 // WindowModalityController is an event filter that consumes events sent to | 42 // WindowModalityController is an event filter that consumes events sent to |
| 32 // windows that are the transient parents of window-modal windows. This filter | 43 // windows that are the transient parents of window-modal windows. This filter |
| 33 // must be added to the CompoundEventFilter so that activation works properly. | 44 // must be added to the CompoundEventFilter so that activation works properly. |
| 34 class WM_EXPORT WindowModalityController : public ui::EventHandler, | 45 class WM_EXPORT WindowModalityController : public ui::EventHandler, |
| 35 public aura::EnvObserver, | 46 public aura::EnvObserver, |
| 36 public aura::WindowObserver { | 47 public aura::WindowObserver { |
| 37 public: | 48 public: |
| 38 explicit WindowModalityController(ui::EventTarget* event_target); | 49 explicit WindowModalityController(ui::EventTarget* event_target); |
| 39 ~WindowModalityController() override; | 50 ~WindowModalityController() override; |
| 40 | 51 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 std::vector<aura::Window*> windows_; | 73 std::vector<aura::Window*> windows_; |
| 63 | 74 |
| 64 ui::EventTarget* event_target_; | 75 ui::EventTarget* event_target_; |
| 65 | 76 |
| 66 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); | 77 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); |
| 67 }; | 78 }; |
| 68 | 79 |
| 69 } // namespace wm | 80 } // namespace wm |
| 70 | 81 |
| 71 #endif // UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 82 #endif // UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
| OLD | NEW |