OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/snap_to_pixel_layout_manager.h" |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "ui/aura/layout_manager.h" | |
15 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
16 #include "ui/keyboard/keyboard_controller_observer.h" | 16 #include "ui/keyboard/keyboard_controller_observer.h" |
17 | 17 |
18 namespace aura { | 18 namespace aura { |
19 class Window; | 19 class Window; |
20 class EventFilter; | 20 class EventFilter; |
21 } | 21 } |
22 namespace gfx { | 22 namespace gfx { |
23 class Rect; | 23 class Rect; |
24 } | 24 } |
25 namespace views { | 25 namespace views { |
26 class Widget; | 26 class Widget; |
27 } | 27 } |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
30 | 30 |
31 // LayoutManager for the modal window container. | 31 // LayoutManager for the modal window container. |
32 // System modal windows which are centered on the screen will be kept centered | 32 // System modal windows which are centered on the screen will be kept centered |
33 // when the container size changes. | 33 // when the container size changes. |
34 class ASH_EXPORT SystemModalContainerLayoutManager | 34 class ASH_EXPORT SystemModalContainerLayoutManager |
35 : public aura::LayoutManager, | 35 : public SnapToPixelLayoutManager, |
36 public aura::WindowObserver, | 36 public aura::WindowObserver, |
37 public keyboard::KeyboardControllerObserver { | 37 public keyboard::KeyboardControllerObserver { |
38 public: | 38 public: |
39 explicit SystemModalContainerLayoutManager(aura::Window* container); | 39 explicit SystemModalContainerLayoutManager(aura::Window* container); |
40 virtual ~SystemModalContainerLayoutManager(); | 40 virtual ~SystemModalContainerLayoutManager(); |
41 | 41 |
42 bool has_modal_background() const { return modal_background_ != NULL; } | 42 bool has_modal_background() const { return modal_background_ != NULL; } |
43 | 43 |
44 // Overridden from aura::LayoutManager: | 44 // Overridden from SnapToPixelLayoutManager: |
45 virtual void OnWindowResized() OVERRIDE; | 45 virtual void OnWindowResized() OVERRIDE; |
46 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 46 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
47 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 47 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
48 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | |
49 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | |
50 bool visibile) OVERRIDE; | |
51 virtual void SetChildBounds(aura::Window* child, | 48 virtual void SetChildBounds(aura::Window* child, |
52 const gfx::Rect& requested_bounds) OVERRIDE; | 49 const gfx::Rect& requested_bounds) OVERRIDE; |
53 | 50 |
54 // Overridden from aura::WindowObserver: | 51 // Overridden from aura::WindowObserver: |
55 virtual void OnWindowPropertyChanged(aura::Window* window, | 52 virtual void OnWindowPropertyChanged(aura::Window* window, |
56 const void* key, | 53 const void* key, |
57 intptr_t old) OVERRIDE; | 54 intptr_t old) OVERRIDE; |
58 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 55 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
59 | 56 |
60 // Overridden from keyboard::KeyboardControllerObserver: | 57 // Overridden from keyboard::KeyboardControllerObserver: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 104 |
108 // A stack of modal windows. Only the topmost can receive events. | 105 // A stack of modal windows. Only the topmost can receive events. |
109 std::vector<aura::Window*> modal_windows_; | 106 std::vector<aura::Window*> modal_windows_; |
110 | 107 |
111 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); | 108 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); |
112 }; | 109 }; |
113 | 110 |
114 } // namespace ash | 111 } // namespace ash |
115 | 112 |
116 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 113 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
OLD | NEW |