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 ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_
6 #define ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_
8 #include "athena/athena_export.h"
9 #include "ui/aura/window_observer.h"
13 // ModalWindow controller manages the modal window and
14 // its container. This gets created when a modal window is opened
15 // and deleted when all modal windows are deleted.
16 class ATHENA_EXPORT ModalWindowController : public aura::WindowObserver {
18 // Returns the ModalWindowController associated with the container.
19 static ModalWindowController* Get(aura::Window* container);
21 explicit ModalWindowController(int container_priority);
22 ~ModalWindowController() override;
24 aura::Window* modal_container() { return modal_container_; }
26 bool dimmed() const { return dimmed_; }
29 // aura::WindowObserver:
30 virtual void OnWindowAdded(aura::Window* child) override;
31 virtual void OnWindowVisibilityChanged(aura::Window* window,
32 bool visible) override;
33 virtual void OnWindowBoundsChanged(aura::Window* window,
34 const gfx::Rect& old_bounds,
35 const gfx::Rect& new_bounds) override;
36 virtual void OnWindowDestroyed(aura::Window* window) override;
38 // Tells if the child is not a dimmer window and a child of the modal
40 bool IsChildWindow(aura::Window* child) const;
42 void UpdateDimmerWindowBounds();
44 // Change dimming state based on the visible window in the container.
45 void UpdateDimming(aura::Window* ignore);
47 // Note: changing true -> false will delete the modal_container_.
48 void SetDimmed(bool dimmed);
50 aura::Window* modal_container_; // not owned.
51 aura::Window* dimmer_window_; // not owned.
54 DISALLOW_COPY_AND_ASSIGN(ModalWindowController);
59 #endif // ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_