| 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 visibility change is scheduled. |
| 66 virtual void WillVisibilityStateChange(VisibilityState new_state) {} |
| 67 |
| 68 // Called when the auto hide state is changed. |
| 69 virtual void OnAutoHideStateChanged(AutoHideState new_state) {} |
| 70 }; |
| 71 |
| 62 // We reserve a small area at the bottom of the workspace area to ensure that | 72 // 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. | 73 // the bottom-of-window resize handle can be hit. |
| 64 // TODO(jamescook): Some day we may want the workspace area to be an even | 74 // 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 | 75 // 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 | 76 // removing this and finding a way for hover and click events to pass through |
| 67 // the invisible parts of the launcher. | 77 // the invisible parts of the launcher. |
| 68 static const int kWorkspaceAreaBottomInset; | 78 static const int kWorkspaceAreaBottomInset; |
| 69 | 79 |
| 70 // Size of the shelf when auto-hidden. | 80 // Size of the shelf when auto-hidden. |
| 71 static const int kAutoHideSize; | 81 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. | 133 // Invoked by the shelf/launcher when the auto-hide state may have changed. |
| 124 void UpdateAutoHideState(); | 134 void UpdateAutoHideState(); |
| 125 | 135 |
| 126 VisibilityState visibility_state() const { return state_.visibility_state; } | 136 VisibilityState visibility_state() const { return state_.visibility_state; } |
| 127 AutoHideState auto_hide_state() const { return state_.auto_hide_state; } | 137 AutoHideState auto_hide_state() const { return state_.auto_hide_state; } |
| 128 | 138 |
| 129 // Sets whether any windows overlap the shelf. If a window overlaps the shelf | 139 // Sets whether any windows overlap the shelf. If a window overlaps the shelf |
| 130 // the shelf renders slightly differently. | 140 // the shelf renders slightly differently. |
| 131 void SetWindowOverlapsShelf(bool value); | 141 void SetWindowOverlapsShelf(bool value); |
| 132 | 142 |
| 143 void AddObserver(Observer* observer); |
| 144 void RemoveObserver(Observer* observer); |
| 145 |
| 133 // Overridden from aura::LayoutManager: | 146 // Overridden from aura::LayoutManager: |
| 134 virtual void OnWindowResized() OVERRIDE; | 147 virtual void OnWindowResized() OVERRIDE; |
| 135 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 148 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 136 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 149 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 137 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 150 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 138 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 151 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 139 bool visible) OVERRIDE; | 152 bool visible) OVERRIDE; |
| 140 virtual void SetChildBounds(aura::Window* child, | 153 virtual void SetChildBounds(aura::Window* child, |
| 141 const gfx::Rect& requested_bounds) OVERRIDE; | 154 const gfx::Rect& requested_bounds) OVERRIDE; |
| 142 | 155 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 258 |
| 246 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. | 259 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. |
| 247 bool window_overlaps_shelf_; | 260 bool window_overlaps_shelf_; |
| 248 | 261 |
| 249 base::OneShotTimer<ShelfLayoutManager> auto_hide_timer_; | 262 base::OneShotTimer<ShelfLayoutManager> auto_hide_timer_; |
| 250 | 263 |
| 251 // EventFilter used to detect when user moves the mouse over the launcher to | 264 // EventFilter used to detect when user moves the mouse over the launcher to |
| 252 // trigger showing the launcher. | 265 // trigger showing the launcher. |
| 253 scoped_ptr<AutoHideEventFilter> event_filter_; | 266 scoped_ptr<AutoHideEventFilter> event_filter_; |
| 254 | 267 |
| 268 ObserverList<Observer> observers_; |
| 269 |
| 255 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 270 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 256 }; | 271 }; |
| 257 | 272 |
| 258 } // namespace internal | 273 } // namespace internal |
| 259 } // namespace ash | 274 } // namespace ash |
| 260 | 275 |
| 261 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ | 276 #endif // ASH_WM_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |