Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ash / wm / maximize_mode / workspace_backdrop_delegate.h
blob0a31c33a047b74413c7a8968e5294e2c857a6ab4
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.
5 #ifndef ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_
6 #define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_
8 #include "ash/ash_export.h"
9 #include "ash/wm/workspace/workspace_layout_manager_delegate.h"
10 #include "base/compiler_specific.h"
11 #include "ui/aura/window_observer.h"
13 namespace aura {
14 class Window;
17 namespace ui {
18 class Layer;
21 namespace views {
22 class Widget;
25 namespace ash {
27 // A background which gets created for a container |window| and which gets
28 // stacked behind the topmost window (within that container) covering the
29 // entire container.
30 class ASH_EXPORT WorkspaceBackdropDelegate
31 : public aura::WindowObserver,
32 public NON_EXPORTED_BASE(WorkspaceLayoutManagerDelegate) {
33 public:
34 explicit WorkspaceBackdropDelegate(aura::Window* container);
35 ~WorkspaceBackdropDelegate() override;
37 // WindowObserver overrides:
38 void OnWindowBoundsChanged(aura::Window* window,
39 const gfx::Rect& old_bounds,
40 const gfx::Rect& new_bounds) override;
42 // WorkspaceLayoutManagerDelegate overrides:
43 void OnWindowAddedToLayout(aura::Window* child) override;
44 void OnWindowRemovedFromLayout(aura::Window* child) override;
45 void OnChildWindowVisibilityChanged(aura::Window* child,
46 bool visible) override;
47 void OnWindowStackingChanged(aura::Window* window) override;
48 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
49 wm::WindowStateType old_type) override;
50 void OnDisplayWorkAreaInsetsChanged() override;
52 private:
53 // Restack the backdrop relatively to the other windows in the container.
54 void RestackBackdrop();
56 // Returns the current visible top level window in the container.
57 aura::Window* GetCurrentTopWindow();
59 // Position & size the background over the container window.
60 void AdjustToContainerBounds();
62 // Show the overlay.
63 void Show();
65 // The background which covers the rest of the screen.
66 views::Widget* background_;
68 // The window which is being "maximized".
69 aura::Window* container_;
71 // If true, the |RestackOrHideWindow| might recurse.
72 bool in_restacking_;
74 DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate);
77 } // namespace ash
79 #endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_