diff options
author | oshima <oshima@chromium.org> | 2014-10-20 10:19:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 17:20:09 +0000 |
commit | 44bf2fd5fb11d3777e522fae68de024c8f6ce46f (patch) | |
tree | ee959cfe4065367147ab432ddd4b22a51f504004 /athena/screen/modal_window_controller.h | |
parent | 3f5d1eae967412133ff221d2aea6dd325b45928c (diff) | |
download | chromium_src-44bf2fd5fb11d3777e522fae68de024c8f6ce46f.zip chromium_src-44bf2fd5fb11d3777e522fae68de024c8f6ce46f.tar.gz chromium_src-44bf2fd5fb11d3777e522fae68de024c8f6ce46f.tar.bz2 |
Support modal windows
* New ContainerParams
- default_parent to specify the default parent when no
transient parent is specified.
- modal_container_priority now controls the modal container
used for a modal window created for the given container.
- if not specified, it will fallback downwards to find one.
- if window is specified as always_on_top, it will use top
most modal container.
* Changed network selector/shutdown dialog to use the new API.
* Other change:
Separated test windows to athena/test/base/test_windows.h
BUG=410499
TBR=sky@chromium.org,reed@chromium.org
TEST=coverd by unit tests
Committed: https://crrev.com/4903fd36b2b36f00efeb1b7bba81b7de6e9457a3
Cr-Commit-Position: refs/heads/master@{#300192}
Review URL: https://codereview.chromium.org/662763002
Cr-Commit-Position: refs/heads/master@{#300288}
Diffstat (limited to 'athena/screen/modal_window_controller.h')
-rw-r--r-- | athena/screen/modal_window_controller.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/athena/screen/modal_window_controller.h b/athena/screen/modal_window_controller.h new file mode 100644 index 0000000..b4c7ec5 --- /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_ |