Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |
| 6 #define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/shell_observer.h" |
| 11 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 11 #include "ash/system/accessibility_observer.h" |
| 12 #include "ash/wm/wm_types.h" | |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 | 14 |
| 15 namespace aura { | |
| 16 class Window; | |
| 17 } | |
| 18 | |
| 14 namespace views { | 19 namespace views { |
| 15 class Widget; | 20 class Widget; |
| 16 } | 21 } |
| 17 | 22 |
| 23 namespace ui { | |
| 24 class EventHandler; | |
| 25 } | |
| 26 | |
| 18 namespace ash { | 27 namespace ash { |
| 28 namespace test { | |
| 29 class WorkspaceControllerTestApi; | |
| 30 } | |
| 19 | 31 |
| 20 class WmWindow; | 32 namespace wm { |
| 33 class WindowState; | |
| 34 } | |
| 21 | 35 |
| 22 // A background which gets created for a container |window| and which gets | 36 class BackdropDelegate; |
| 37 | |
| 38 // A backdrop which gets created for a container |window| and which gets | |
| 23 // stacked behind the topmost window (within that container) covering the | 39 // stacked behind the topmost window (within that container) covering the |
| 24 // entire container. | 40 // entire container. |
|
James Cook
2017/05/15 21:57:39
Please expand this comment to say why the backdrop
oshima
2017/05/16 08:22:09
I updated to be more generic
James Cook
2017/05/16 15:12:14
Can you copy the text you added to the CL descript
oshima
2017/05/17 07:44:33
I added the comment, although I don't want to put
| |
| 25 class ASH_EXPORT WorkspaceBackdropDelegate | 41 class BackdropController : public ShellObserver, public AccessibilityObserver { |
| 26 : public WorkspaceLayoutManagerBackdropDelegate { | |
| 27 public: | 42 public: |
| 28 explicit WorkspaceBackdropDelegate(WmWindow* container); | 43 explicit BackdropController(WmWindow* container); |
|
James Cook
2017/05/15 21:57:39
Is it possible to take aura::Window* here?
James Cook
2017/05/16 15:12:14
Again, can you take aura::Window here instead of W
oshima
2017/05/17 07:44:34
Done.
| |
| 29 ~WorkspaceBackdropDelegate() override; | 44 ~BackdropController() override; |
| 30 | 45 |
| 31 // WorkspaceLayoutManagerBackdropDelegate overrides: | 46 void OnWindowAddedToLayout(aura::Window* child); |
|
James Cook
2017/05/15 21:57:39
Thanks for switching from WmWindow to aura::Window
| |
| 32 void OnWindowAddedToLayout(WmWindow* child) override; | 47 void OnWindowRemovedFromLayout(aura::Window* child); |
| 33 void OnWindowRemovedFromLayout(WmWindow* child) override; | 48 void OnChildWindowVisibilityChanged(aura::Window* child, bool visible); |
| 34 void OnChildWindowVisibilityChanged(WmWindow* child, bool visible) override; | 49 void OnWindowStackingChanged(aura::Window* window); |
| 35 void OnWindowStackingChanged(WmWindow* window) override; | |
| 36 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 50 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| 37 wm::WindowStateType old_type) override; | 51 wm::WindowStateType old_type); |
| 52 | |
| 53 void SetBackdropDelegate(std::unique_ptr<BackdropDelegate> delegate); | |
| 54 | |
| 55 // Update the visibility of, and Restack the backdrop relatively to | |
|
James Cook
2017/05/15 21:57:39
nit: Restack -> restack, relatively -> relative
oshima
2017/05/16 08:22:08
Done.
| |
| 56 // the other windows in the container. | |
| 57 void UpdateBackdrop(); | |
| 58 | |
| 59 // ShellObserver: | |
| 60 void OnOverviewModeStarting() override; | |
| 61 void OnOverviewModeEnded() override; | |
| 62 | |
| 63 // AccessibilityObserver: | |
| 64 void OnAccessibilityModeChanged( | |
| 65 AccessibilityNotificationVisibility notify) override; | |
| 38 | 66 |
| 39 private: | 67 private: |
| 40 // Restack the backdrop relatively to the other windows in the container. | 68 friend class test::WorkspaceControllerTestApi; |
| 41 void RestackBackdrop(); | |
| 42 | 69 |
| 43 // Returns the current visible top level window in the container. | 70 void EnsureBackdropWidget(); |
| 44 WmWindow* GetCurrentTopWindow(); | 71 |
| 72 void UpdateAccessibilityMode(); | |
| 45 | 73 |
| 46 // Show the overlay. | 74 // Show the overlay. |
| 47 void Show(); | 75 void Show(); |
| 48 | 76 |
| 49 // The background which covers the rest of the screen. | 77 // Hide the overlay. |
|
James Cook
2017/05/15 21:57:39
overlay -> backdrop? and above?
oshima
2017/05/16 08:22:09
Done.
| |
| 50 views::Widget* background_ = nullptr; | 78 void Hide(); |
| 51 // WmWindow for |background_|. | |
| 52 WmWindow* background_window_ = nullptr; | |
| 53 | 79 |
| 54 // The window which is being "maximized". | 80 // Returns the current visible top level window in the container. |
| 81 aura::Window* GetTopmostWindowWithBackdrop(); | |
| 82 | |
| 83 // The backdrop which covers the rest of the screen. | |
| 84 views::Widget* backdrop_ = nullptr; | |
| 85 | |
| 86 // aura::Window for |backdrop_|. | |
| 87 aura::Window* backdrop_window_ = nullptr; | |
| 88 | |
| 89 // The container of the window that should have a backdrop. | |
| 55 WmWindow* container_; | 90 WmWindow* container_; |
| 56 | 91 |
| 92 std::unique_ptr<BackdropDelegate> delegate_; | |
| 93 | |
| 94 // Event hanlder used to implement actions for accessibility. | |
| 95 std::unique_ptr<ui::EventHandler> backdrop_event_handler_; | |
| 96 ui::EventHandler* original_event_handler_ = nullptr; | |
| 97 | |
| 57 // If true, the |RestackOrHideWindow| might recurse. | 98 // If true, the |RestackOrHideWindow| might recurse. |
| 58 bool in_restacking_; | 99 bool in_restacking_; |
|
James Cook
2017/05/15 21:57:39
nit: initialize here, like the others
oshima
2017/05/16 08:22:08
Done.
| |
| 59 | 100 |
| 60 DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate); | 101 // True to temporarily hide the backdrop. Used in |
| 102 // overview mode. | |
| 103 bool force_hidden_ = false; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(BackdropController); | |
| 61 }; | 106 }; |
| 62 | 107 |
| 63 } // namespace ash | 108 } // namespace ash |
| 64 | 109 |
| 65 #endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 110 #endif // ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |
| OLD | NEW |