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_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
11 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
12 #include "ash/wm/shelf_types.h" | 12 #include "ash/wm/shelf_types.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/observer_list.h" |
15 #include "base/timer.h" | 16 #include "base/timer.h" |
16 #include "ui/aura/client/activation_change_observer.h" | 17 #include "ui/aura/client/activation_change_observer.h" |
17 #include "ui/aura/layout_manager.h" | 18 #include "ui/aura/layout_manager.h" |
18 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 | 21 |
21 namespace aura { | 22 namespace aura { |
22 class RootWindow; | 23 class RootWindow; |
23 } | 24 } |
24 | 25 |
(...skipping 27 matching lines...) Expand all Loading... |
52 | 53 |
53 // Nothing is shown. Used for fullscreen windows. | 54 // Nothing is shown. Used for fullscreen windows. |
54 HIDDEN, | 55 HIDDEN, |
55 }; | 56 }; |
56 | 57 |
57 enum AutoHideState { | 58 enum AutoHideState { |
58 AUTO_HIDE_SHOWN, | 59 AUTO_HIDE_SHOWN, |
59 AUTO_HIDE_HIDDEN, | 60 AUTO_HIDE_HIDDEN, |
60 }; | 61 }; |
61 | 62 |
| 63 class ASH_EXPORT Observer { |
| 64 public: |
| 65 // Called when the target ShelfLayoutManager will be deleted. |
| 66 virtual void WillDeleteShelf() {} |
| 67 |
| 68 // Called when the visibility change is scheduled. |
| 69 virtual void WillChangeVisibilityState(VisibilityState new_state) {} |
| 70 |
| 71 // Called when the auto hide state is changed. |
| 72 virtual void OnAutoHideStateChanged(AutoHideState new_state) {} |
| 73 }; |
| 74 |
62 // We reserve a small area at the bottom of the workspace area to ensure that | 75 // We reserve a small area at the bottom of the workspace area to ensure that |
63 // the bottom-of-window resize handle can be hit. | 76 // the bottom-of-window resize handle can be hit. |
64 // TODO(jamescook): Some day we may want the workspace area to be an even | 77 // TODO(jamescook): Some day we may want the workspace area to be an even |
65 // multiple of the size of the grid (currently 8 pixels), which will require | 78 // multiple of the size of the grid (currently 8 pixels), which will require |
66 // removing this and finding a way for hover and click events to pass through | 79 // removing this and finding a way for hover and click events to pass through |
67 // the invisible parts of the launcher. | 80 // the invisible parts of the launcher. |
68 static const int kWorkspaceAreaBottomInset; | 81 static const int kWorkspaceAreaBottomInset; |
69 | 82 |
70 // Size of the shelf when auto-hidden. | 83 // Size of the shelf when auto-hidden. |
71 static const int kAutoHideSize; | 84 static const int kAutoHideSize; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Invoked by the shelf/launcher when the auto-hide state may have changed. | 136 // Invoked by the shelf/launcher when the auto-hide state may have changed. |
124 void UpdateAutoHideState(); | 137 void UpdateAutoHideState(); |
125 | 138 |
126 VisibilityState visibility_state() const { return state_.visibility_state; } | 139 VisibilityState visibility_state() const { return state_.visibility_state; } |
127 AutoHideState auto_hide_state() const { return state_.auto_hide_state; } | 140 AutoHideState auto_hide_state() const { return state_.auto_hide_state; } |
128 | 141 |
129 // Sets whether any windows overlap the shelf. If a window overlaps the shelf | 142 // Sets whether any windows overlap the shelf. If a window overlaps the shelf |
130 // the shelf renders slightly differently. | 143 // the shelf renders slightly differently. |
131 void SetWindowOverlapsShelf(bool value); | 144 void SetWindowOverlapsShelf(bool value); |
132 | 145 |
| 146 void AddObserver(Observer* observer); |
| 147 void RemoveObserver(Observer* observer); |
| 148 |
133 // Overridden from aura::LayoutManager: | 149 // Overridden from aura::LayoutManager: |
134 virtual void OnWindowResized() OVERRIDE; | 150 virtual void OnWindowResized() OVERRIDE; |
135 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 151 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
136 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 152 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
137 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 153 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
138 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 154 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
139 bool visible) OVERRIDE; | 155 bool visible) OVERRIDE; |
140 virtual void SetChildBounds(aura::Window* child, | 156 virtual void SetChildBounds(aura::Window* child, |
141 const gfx::Rect& requested_bounds) OVERRIDE; | 157 const gfx::Rect& requested_bounds) OVERRIDE; |
142 | 158 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 261 |
246 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. | 262 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. |
247 bool window_overlaps_shelf_; | 263 bool window_overlaps_shelf_; |
248 | 264 |
249 base::OneShotTimer<ShelfLayoutManager> auto_hide_timer_; | 265 base::OneShotTimer<ShelfLayoutManager> auto_hide_timer_; |
250 | 266 |
251 // EventFilter used to detect when user moves the mouse over the launcher to | 267 // EventFilter used to detect when user moves the mouse over the launcher to |
252 // trigger showing the launcher. | 268 // trigger showing the launcher. |
253 scoped_ptr<AutoHideEventFilter> event_filter_; | 269 scoped_ptr<AutoHideEventFilter> event_filter_; |
254 | 270 |
| 271 ObserverList<Observer> observers_; |
| 272 |
255 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 273 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
256 }; | 274 }; |
257 | 275 |
258 } // namespace internal | 276 } // namespace internal |
259 } // namespace ash | 277 } // namespace ash |
260 | 278 |
261 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ | 279 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
OLD | NEW |