Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: athena/screen/modal_window_controller.h

Issue 662763002: Support modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: fix leaks Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/screen/DEPS ('k') | athena/screen/modal_window_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/screen/modal_window_controller.h
diff --git a/athena/screen/modal_window_controller.h b/athena/screen/modal_window_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..b4c7ec5b3033fd7784d04d66840e35f8b7852729
--- /dev/null
+++ b/athena/screen/modal_window_controller.h
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_
+#define ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_
+
+#include "athena/athena_export.h"
+#include "ui/aura/window_observer.h"
+
+namespace athena {
+
+// ModalWindow controller manages the modal window and
+// its container. This gets created when a modal window is opened
+// and deleted when all modal windows are deleted.
+class ATHENA_EXPORT ModalWindowController : public aura::WindowObserver {
+ public:
+ // Returns the ModalWindowController associated with the container.
+ static ModalWindowController* Get(aura::Window* container);
+
+ explicit ModalWindowController(int container_priority);
+ virtual ~ModalWindowController();
+
+ aura::Window* modal_container() { return modal_container_; }
+
+ bool dimmed() const { return dimmed_; }
+
+ private:
+ // aura::WindowObserver:
+ virtual void OnWindowAdded(aura::Window* child) override;
+ virtual void OnWindowVisibilityChanged(aura::Window* window,
+ bool visible) override;
+ virtual void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override;
+ virtual void OnWindowDestroyed(aura::Window* window) override;
+
+ // Tells if the child is not a dimmer window and a child of the modal
+ // container.
+ bool IsChildWindow(aura::Window* child) const;
+
+ void UpdateDimmerWindowBounds();
+
+ // Change dimming state based on the visible window in the container.
+ void UpdateDimming(aura::Window* ignore);
+
+ // Note: changing true -> false will delete the modal_container_.
+ void SetDimmed(bool dimmed);
+
+ aura::Window* modal_container_; // not owned.
+ aura::Window* dimmer_window_; // not owned.
+
+ bool dimmed_;
+ DISALLOW_COPY_AND_ASSIGN(ModalWindowController);
+};
+
+} // namespace athena
+
+#endif // ATHENA_SCREEN_MODAL_WINDOW_CONTROLLER_H_
« no previous file with comments | « athena/screen/DEPS ('k') | athena/screen/modal_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698