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_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ 6#define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ 7 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" 12 13namespace aura { 14class Window; 15} 16 17namespace ui { 18class Layer; 19} 20 21namespace views { 22class Widget; 23} 24 25namespace ash { 26 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. 30class ASH_EXPORT WorkspaceBackdropDelegate 31 : public aura::WindowObserver, 32 public NON_EXPORTED_BASE(WorkspaceLayoutManagerDelegate) { 33 public: 34 explicit WorkspaceBackdropDelegate(aura::Window* container); 35 virtual ~WorkspaceBackdropDelegate(); 36 37 // WindowObserver overrides: 38 virtual void OnWindowBoundsChanged(aura::Window* window, 39 const gfx::Rect& old_bounds, 40 const gfx::Rect& new_bounds) OVERRIDE; 41 42 // WorkspaceLayoutManagerDelegate overrides: 43 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; 44 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; 45 virtual void OnChildWindowVisibilityChanged(aura::Window* child, 46 bool visible) OVERRIDE; 47 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; 48 virtual void OnPostWindowStateTypeChange( 49 wm::WindowState* window_state, 50 wm::WindowStateType old_type) OVERRIDE; 51 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; 52 53 private: 54 // Restack the backdrop relatively to the other windows in the container. 55 void RestackBackdrop(); 56 57 // Returns the current visible top level window in the container. 58 aura::Window* GetCurrentTopWindow(); 59 60 // Position & size the background over the container window. 61 void AdjustToContainerBounds(); 62 63 // Show the overlay. 64 void Show(); 65 66 // The background which covers the rest of the screen. 67 views::Widget* background_; 68 69 // The window which is being "maximized". 70 aura::Window* container_; 71 72 // If true, the |RestackOrHideWindow| might recurse. 73 bool in_restacking_; 74 75 DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate); 76}; 77 78} // namespace ash 79 80#endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ 81