summaryrefslogtreecommitdiffstats
path: root/ash/wm/system_modal_container_layout_manager.h
diff options
context:
space:
mode:
authorflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 20:03:46 +0000
committerflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 20:03:46 +0000
commite871f1a0bdf9c09b2c72e521b179ebb2fd6dc4e9 (patch)
treec97ba41c7fe07b9cffcdc71083bb2f5d58205e85 /ash/wm/system_modal_container_layout_manager.h
parent000d9df01681c4d0fb722c797ba0a398c3756504 (diff)
downloadchromium_src-e871f1a0bdf9c09b2c72e521b179ebb2fd6dc4e9.zip
chromium_src-e871f1a0bdf9c09b2c72e521b179ebb2fd6dc4e9.tar.gz
chromium_src-e871f1a0bdf9c09b2c72e521b179ebb2fd6dc4e9.tar.bz2
Rename system modal types and classes appropriately.
Renames the following as per the bug description by ben@: kShellWindowId_ModalContainer -> kShellWindowId_SystemModalContainer kShellWindowId_LockModalContainer -> kShellWindowId_LockSystemModalContainer ModalContainerLayoutManager->SystemModalContainerLayoutManager ModalityEventFilter->SystemModalContainerEventFilter BUG=109460 TEST=All tests and compilation still succeed. Review URL: https://chromiumcodereview.appspot.com/9249022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/system_modal_container_layout_manager.h')
-rw-r--r--ash/wm/system_modal_container_layout_manager.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/ash/wm/system_modal_container_layout_manager.h b/ash/wm/system_modal_container_layout_manager.h
new file mode 100644
index 0000000..c713500
--- /dev/null
+++ b/ash/wm/system_modal_container_layout_manager.h
@@ -0,0 +1,102 @@
+// Copyright (c) 2012 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 ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_
+#define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_
+#pragma once
+
+#include <vector>
+
+#include "ash/wm/system_modal_container_event_filter_delegate.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/aura/layout_manager.h"
+#include "ui/aura/window_observer.h"
+#include "ash/ash_export.h"
+#include "ui/gfx/compositor/layer_animation_observer.h"
+
+namespace aura {
+class Window;
+class EventFilter;
+}
+namespace gfx {
+class Rect;
+}
+namespace views {
+class Widget;
+}
+
+namespace ash {
+namespace internal {
+
+// LayoutManager for the modal window container.
+class ASH_EXPORT SystemModalContainerLayoutManager
+ : public aura::LayoutManager,
+ public aura::WindowObserver,
+ public ui::LayerAnimationObserver,
+ public SystemModalContainerEventFilterDelegate {
+ public:
+ explicit SystemModalContainerLayoutManager(aura::Window* container);
+ virtual ~SystemModalContainerLayoutManager();
+
+ // Overridden from aura::LayoutManager:
+ virtual void OnWindowResized() OVERRIDE;
+ virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visibile) OVERRIDE;
+ virtual void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) OVERRIDE;
+
+ // Overridden from aura::WindowObserver:
+ virtual void OnWindowPropertyChanged(aura::Window* window,
+ const char* key,
+ void* old) OVERRIDE;
+
+ // Overridden from ui::LayerAnimationObserver:
+ virtual void OnLayerAnimationEnded(
+ const ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationAborted(
+ const ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationScheduled(
+ const ui::LayerAnimationSequence* sequence) OVERRIDE;
+
+ // Overridden from SystemModalContainerEventFilterDelegate:
+ virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
+
+ private:
+ void AddModalWindow(aura::Window* window);
+ void RemoveModalWindow(aura::Window* window);
+
+ void CreateModalScreen();
+ void DestroyModalScreen();
+ void HideModalScreen();
+
+ aura::Window* modal_window() {
+ return !modal_windows_.empty() ? modal_windows_.back() : NULL;
+ }
+
+ // The container that owns the layout manager.
+ aura::Window* container_;
+
+ // A "screen" widget that dims the windows behind the modal window(s) being
+ // shown in |container_|.
+ views::Widget* modal_screen_;
+
+ // A stack of modal windows. Only the topmost can receive events.
+ std::vector<aura::Window*> modal_windows_;
+
+ // An event filter that enforces the modality of the topmost window in
+ // |modal_windows_|. The event filter is attached when a modal window is
+ // added, and removed when the last is closed.
+ scoped_ptr<aura::EventFilter> modality_filter_;
+
+ DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_