OLD | NEW |
(Empty) | |
| 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 ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_ |
| 6 #define ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_ |
| 7 |
| 8 #include "athena/athena_export.h" |
| 9 #include "ui/aura/window_observer.h" |
| 10 |
| 11 namespace athena { |
| 12 |
| 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 { |
| 17 public: |
| 18 // Returns the ModalWindowController associated with the container. |
| 19 static ModalWindowController* Get(aura::Window* container); |
| 20 |
| 21 explicit ModalWindowController(int container_priority); |
| 22 virtual ~ModalWindowController(); |
| 23 |
| 24 aura::Window* modal_container() { return modal_container_; } |
| 25 |
| 26 bool dimmed() const { return dimmed_; } |
| 27 |
| 28 private: |
| 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; |
| 37 |
| 38 // Tells if the child is not a dimmer window and a child of the modal |
| 39 // container. |
| 40 bool IsChildWindow(aura::Window* child) const; |
| 41 |
| 42 void UpdateDimmerWindowBounds(); |
| 43 |
| 44 // Change dimming state based on the visible window in the container. |
| 45 void UpdateDimming(aura::Window* ignore); |
| 46 |
| 47 // Note: changing true -> false will delete the modal_container_. |
| 48 void SetDimmed(bool dimmed); |
| 49 |
| 50 aura::Window* modal_container_; // not owned. |
| 51 aura::Window* dimmer_window_; // not owned. |
| 52 |
| 53 bool dimmed_; |
| 54 DISALLOW_COPY_AND_ASSIGN(ModalWindowController); |
| 55 }; |
| 56 |
| 57 } // namespace athena |
| 58 |
| 59 #endif // ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_ |
OLD | NEW |