Chromium Code Reviews| Index: ash/wm/workspace/backdrop_controller.h |
| diff --git a/ash/wm/maximize_mode/workspace_backdrop_delegate.h b/ash/wm/workspace/backdrop_controller.h |
| similarity index 25% |
| rename from ash/wm/maximize_mode/workspace_backdrop_delegate.h |
| rename to ash/wm/workspace/backdrop_controller.h |
| index b6fdab20639585af90fe0d9ab1dd6945330abc3d..2299495e8cef0d02bec2ffe8e9c685bdb798bc74 100644 |
| --- a/ash/wm/maximize_mode/workspace_backdrop_delegate.h |
| +++ b/ash/wm/workspace/backdrop_controller.h |
| @@ -2,64 +2,109 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
| -#define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
| +#ifndef ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |
| +#define ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |
| #include <memory> |
| -#include "ash/ash_export.h" |
| -#include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
| +#include "ash/shell_observer.h" |
| +#include "ash/system/accessibility_observer.h" |
| +#include "ash/wm/wm_types.h" |
| #include "base/macros.h" |
| +namespace aura { |
| +class Window; |
| +} |
| + |
| namespace views { |
| class Widget; |
| } |
| +namespace ui { |
| +class EventHandler; |
| +} |
| + |
| namespace ash { |
| +namespace test { |
| +class WorkspaceControllerTestApi; |
| +} |
| -class WmWindow; |
| +namespace wm { |
| +class WindowState; |
| +} |
| -// A background which gets created for a container |window| and which gets |
| +class BackdropDelegate; |
| + |
| +// A backdrop which gets created for a container |window| and which gets |
| // stacked behind the topmost window (within that container) covering the |
| // 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
|
| -class ASH_EXPORT WorkspaceBackdropDelegate |
| - : public WorkspaceLayoutManagerBackdropDelegate { |
| +class BackdropController : public ShellObserver, public AccessibilityObserver { |
| public: |
| - explicit WorkspaceBackdropDelegate(WmWindow* container); |
| - ~WorkspaceBackdropDelegate() override; |
| - |
| - // WorkspaceLayoutManagerBackdropDelegate overrides: |
| - void OnWindowAddedToLayout(WmWindow* child) override; |
| - void OnWindowRemovedFromLayout(WmWindow* child) override; |
| - void OnChildWindowVisibilityChanged(WmWindow* child, bool visible) override; |
| - void OnWindowStackingChanged(WmWindow* window) override; |
| + 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.
|
| + ~BackdropController() override; |
| + |
| + void OnWindowAddedToLayout(aura::Window* child); |
|
James Cook
2017/05/15 21:57:39
Thanks for switching from WmWindow to aura::Window
|
| + void OnWindowRemovedFromLayout(aura::Window* child); |
| + void OnChildWindowVisibilityChanged(aura::Window* child, bool visible); |
| + void OnWindowStackingChanged(aura::Window* window); |
| void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| - wm::WindowStateType old_type) override; |
| + wm::WindowStateType old_type); |
| + |
| + void SetBackdropDelegate(std::unique_ptr<BackdropDelegate> delegate); |
| + |
| + // 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.
|
| + // the other windows in the container. |
| + void UpdateBackdrop(); |
| + |
| + // ShellObserver: |
| + void OnOverviewModeStarting() override; |
| + void OnOverviewModeEnded() override; |
| + |
| + // AccessibilityObserver: |
| + void OnAccessibilityModeChanged( |
| + AccessibilityNotificationVisibility notify) override; |
| private: |
| - // Restack the backdrop relatively to the other windows in the container. |
| - void RestackBackdrop(); |
| + friend class test::WorkspaceControllerTestApi; |
| - // Returns the current visible top level window in the container. |
| - WmWindow* GetCurrentTopWindow(); |
| + void EnsureBackdropWidget(); |
| + |
| + void UpdateAccessibilityMode(); |
| // Show the overlay. |
| void Show(); |
| - // The background which covers the rest of the screen. |
| - views::Widget* background_ = nullptr; |
| - // WmWindow for |background_|. |
| - WmWindow* background_window_ = nullptr; |
| + // Hide the overlay. |
|
James Cook
2017/05/15 21:57:39
overlay -> backdrop? and above?
oshima
2017/05/16 08:22:09
Done.
|
| + void Hide(); |
| + |
| + // Returns the current visible top level window in the container. |
| + aura::Window* GetTopmostWindowWithBackdrop(); |
| + |
| + // The backdrop which covers the rest of the screen. |
| + views::Widget* backdrop_ = nullptr; |
| + |
| + // aura::Window for |backdrop_|. |
| + aura::Window* backdrop_window_ = nullptr; |
| - // The window which is being "maximized". |
| + // The container of the window that should have a backdrop. |
| WmWindow* container_; |
| + std::unique_ptr<BackdropDelegate> delegate_; |
| + |
| + // Event hanlder used to implement actions for accessibility. |
| + std::unique_ptr<ui::EventHandler> backdrop_event_handler_; |
| + ui::EventHandler* original_event_handler_ = nullptr; |
| + |
| // If true, the |RestackOrHideWindow| might recurse. |
| 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.
|
| - DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate); |
| + // True to temporarily hide the backdrop. Used in |
| + // overview mode. |
| + bool force_hidden_ = false; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BackdropController); |
| }; |
| } // namespace ash |
| -#endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
| +#endif // ASH_WM_WORKSPACE_WORKSPACE_BACKDROP_DELEGATE_IMPL_H_ |