| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ | |
| 6 #define ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "ash/shell_observer.h" | |
| 11 #include "ash/system/accessibility_observer.h" | |
| 12 #include "ash/wm/wm_types.h" | |
| 13 #include "base/macros.h" | |
| 14 | |
| 15 namespace aura { | |
| 16 class Window; | |
| 17 } | |
| 18 | |
| 19 namespace views { | |
| 20 class Widget; | |
| 21 } | |
| 22 | |
| 23 namespace ui { | |
| 24 class EventHandler; | |
| 25 } | |
| 26 | |
| 27 namespace ash { | |
| 28 namespace test { | |
| 29 class WorkspaceControllerTestApi; | |
| 30 } | |
| 31 | |
| 32 namespace wm { | |
| 33 class WindowState; | |
| 34 } | |
| 35 | |
| 36 class BackdropDelegate; | |
| 37 | |
| 38 // A backdrop which gets created for a container |window| and which gets | |
| 39 // stacked behind the top level, activatable window that meets the following | |
| 40 // criteria. | |
| 41 // | |
| 42 // 1) Has a aura::client::kHasBackdrop property = true. | |
| 43 // 2) BackdropDelegate::HasBackdrop(aura::Window* window) returns true. | |
| 44 // 3) Active ARC window when the spoken feedback is enabled. | |
| 45 class BackdropController : public ShellObserver, public AccessibilityObserver { | |
| 46 public: | |
| 47 explicit BackdropController(aura::Window* container); | |
| 48 ~BackdropController() override; | |
| 49 | |
| 50 void OnWindowAddedToLayout(aura::Window* child); | |
| 51 void OnWindowRemovedFromLayout(aura::Window* child); | |
| 52 void OnChildWindowVisibilityChanged(aura::Window* child, bool visible); | |
| 53 void OnWindowStackingChanged(aura::Window* window); | |
| 54 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | |
| 55 wm::WindowStateType old_type); | |
| 56 | |
| 57 void SetBackdropDelegate(std::unique_ptr<BackdropDelegate> delegate); | |
| 58 | |
| 59 // Update the visibility of, and restack the backdrop relative to | |
| 60 // the other windows in the container. | |
| 61 void UpdateBackdrop(); | |
| 62 | |
| 63 // ShellObserver: | |
| 64 void OnOverviewModeStarting() override; | |
| 65 void OnOverviewModeEnded() override; | |
| 66 | |
| 67 // AccessibilityObserver: | |
| 68 void OnAccessibilityModeChanged( | |
| 69 AccessibilityNotificationVisibility notify) override; | |
| 70 | |
| 71 private: | |
| 72 friend class test::WorkspaceControllerTestApi; | |
| 73 | |
| 74 void EnsureBackdropWidget(); | |
| 75 | |
| 76 void UpdateAccessibilityMode(); | |
| 77 | |
| 78 // Returns the current visible top level window in the container. | |
| 79 aura::Window* GetTopmostWindowWithBackdrop(); | |
| 80 | |
| 81 bool WindowShouldHaveBackdrop(aura::Window* window); | |
| 82 | |
| 83 // Show the backdrop window. | |
| 84 void Show(); | |
| 85 | |
| 86 // Hide the backdrop window. | |
| 87 void Hide(); | |
| 88 | |
| 89 // The backdrop which covers the rest of the screen. | |
| 90 views::Widget* backdrop_ = nullptr; | |
| 91 | |
| 92 // aura::Window for |backdrop_|. | |
| 93 aura::Window* backdrop_window_ = nullptr; | |
| 94 | |
| 95 // The container of the window that should have a backdrop. | |
| 96 aura::Window* container_; | |
| 97 | |
| 98 std::unique_ptr<BackdropDelegate> delegate_; | |
| 99 | |
| 100 // Event hanlder used to implement actions for accessibility. | |
| 101 std::unique_ptr<ui::EventHandler> backdrop_event_handler_; | |
| 102 ui::EventHandler* original_event_handler_ = nullptr; | |
| 103 | |
| 104 // If true, the |RestackOrHideWindow| might recurse. | |
| 105 bool in_restacking_ = false; | |
| 106 | |
| 107 // True to temporarily hide the backdrop. Used in | |
| 108 // overview mode. | |
| 109 bool force_hidden_ = false; | |
| 110 | |
| 111 DISALLOW_COPY_AND_ASSIGN(BackdropController); | |
| 112 }; | |
| 113 | |
| 114 } // namespace ash | |
| 115 | |
| 116 #endif // ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ | |
| OLD | NEW |