Move render_view_context_menu.* and related files out of tab_contents.
[chromium-blink-merge.git] / ash / wm / system_modal_container_layout_manager.h
blob76618ece07179f897fd23d0056477ba03985901f
1 // Copyright (c) 2012 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 ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_
6 #define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_
8 #include <vector>
10 #include "ash/ash_export.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/layout_manager.h"
15 #include "ui/aura/window_observer.h"
17 namespace aura {
18 class Window;
19 class EventFilter;
21 namespace gfx {
22 class Rect;
24 namespace views {
25 class Widget;
28 namespace ash {
29 namespace internal {
31 // LayoutManager for the modal window container.
32 class ASH_EXPORT SystemModalContainerLayoutManager
33 : public aura::LayoutManager,
34 public aura::WindowObserver {
35 public:
36 explicit SystemModalContainerLayoutManager(aura::Window* container);
37 virtual ~SystemModalContainerLayoutManager();
39 bool has_modal_background() const { return modal_background_ != NULL; }
41 // Overridden from aura::LayoutManager:
42 virtual void OnWindowResized() OVERRIDE;
43 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
44 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
45 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
46 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
47 bool visibile) OVERRIDE;
48 virtual void SetChildBounds(aura::Window* child,
49 const gfx::Rect& requested_bounds) OVERRIDE;
51 // Overridden from aura::WindowObserver:
52 virtual void OnWindowPropertyChanged(aura::Window* window,
53 const void* key,
54 intptr_t old) OVERRIDE;
55 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
57 // Can a given |window| receive and handle input events?
58 bool CanWindowReceiveEvents(aura::Window* window);
60 // Activates next modal window if any. Returns false if there
61 // are no more modal windows in this layout manager.
62 bool ActivateNextModalWindow();
64 // Creates modal background window, which is a partially-opaque
65 // fullscreen window. If there is already a modal background window,
66 // it will bring it the top.
67 void CreateModalBackground();
69 void DestroyModalBackground();
71 // Is the |window| modal background?
72 static bool IsModalBackground(aura::Window* window);
74 private:
75 void AddModalWindow(aura::Window* window);
76 void RemoveModalWindow(aura::Window* window);
78 aura::Window* modal_window() {
79 return !modal_windows_.empty() ? modal_windows_.back() : NULL;
82 // The container that owns the layout manager.
83 aura::Window* container_;
85 // A widget that dims the windows behind the modal window(s) being
86 // shown in |container_|.
87 views::Widget* modal_background_;
89 // A stack of modal windows. Only the topmost can receive events.
90 std::vector<aura::Window*> modal_windows_;
92 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager);
95 } // namespace internal
96 } // namespace ash
98 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_