| 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_SHELF_SHELF_WIDGET_H_ | 5 #ifndef ASH_SHELF_SHELF_WIDGET_H_ |
| 6 #define ASH_SHELF_SHELF_WIDGET_H_ | 6 #define ASH_SHELF_SHELF_WIDGET_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/common/shelf/shelf_background_animator.h" |
| 12 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 11 #include "ash/common/shelf/shelf_types.h" | 13 #include "ash/common/shelf/shelf_types.h" |
| 12 #include "ash/common/wm/background_animator.h" | |
| 13 #include "ash/shelf/shelf_layout_manager_observer.h" | 14 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 class FocusCycler; | 20 class FocusCycler; |
| 20 class Shelf; | 21 class Shelf; |
| 21 class ShelfLayoutManager; | 22 class ShelfLayoutManager; |
| 22 class StatusAreaWidget; | 23 class StatusAreaWidget; |
| 23 class WmShelfAura; | 24 class WmShelfAura; |
| 24 class WmWindow; | 25 class WmWindow; |
| 25 class WorkspaceController; | 26 class WorkspaceController; |
| 26 | 27 |
| 27 class ASH_EXPORT ShelfWidget : public views::Widget, | 28 class ASH_EXPORT ShelfWidget : public views::Widget, |
| 28 public views::WidgetObserver, | 29 public views::WidgetObserver, |
| 30 public ShelfBackgroundAnimatorObserver, |
| 29 public ShelfLayoutManagerObserver { | 31 public ShelfLayoutManagerObserver { |
| 30 public: | 32 public: |
| 31 ShelfWidget(WmWindow* wm_shelf_container, | 33 ShelfWidget(WmWindow* wm_shelf_container, |
| 32 WmWindow* wm_status_container, | 34 WmWindow* wm_status_container, |
| 33 WmShelfAura* wm_shelf_aura, | 35 WmShelfAura* wm_shelf_aura, |
| 34 WorkspaceController* workspace_controller); | 36 WorkspaceController* workspace_controller); |
| 35 ~ShelfWidget() override; | 37 ~ShelfWidget() override; |
| 36 | 38 |
| 37 // Returns if shelf alignment option is enabled, and the user is able to | 39 // Returns if shelf alignment option is enabled, and the user is able to |
| 38 // adjust the alignment (guest and supervised mode users cannot for example). | 40 // adjust the alignment (guest and supervised mode users cannot for example). |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 bool IsShelfHiddenBehindBlackBar() const; | 54 bool IsShelfHiddenBehindBlackBar() const; |
| 53 | 55 |
| 54 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). | 56 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). |
| 55 void SetDimsShelf(bool dimming); | 57 void SetDimsShelf(bool dimming); |
| 56 bool GetDimsShelf() const; | 58 bool GetDimsShelf() const; |
| 57 | 59 |
| 58 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } | 60 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } |
| 59 Shelf* shelf() const { return shelf_.get(); } | 61 Shelf* shelf() const { return shelf_.get(); } |
| 60 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } | 62 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } |
| 61 | 63 |
| 62 void CreateShelf(WmShelfAura* wm_shelf_aura); | 64 void CreateShelf(); |
| 63 void PostCreateShelf(); | 65 void PostCreateShelf(); |
| 64 | 66 |
| 65 // Set visibility of the shelf. | 67 // Set visibility of the shelf. |
| 66 void SetShelfVisibility(bool visible); | 68 void SetShelfVisibility(bool visible); |
| 67 bool IsShelfVisible() const; | 69 bool IsShelfVisible() const; |
| 68 | 70 |
| 69 // Sets the focus cycler. Also adds the shelf to the cycle. | 71 // Sets the focus cycler. Also adds the shelf to the cycle. |
| 70 void SetFocusCycler(FocusCycler* focus_cycler); | 72 void SetFocusCycler(FocusCycler* focus_cycler); |
| 71 FocusCycler* GetFocusCycler(); | 73 FocusCycler* GetFocusCycler(); |
| 72 | 74 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 // no dimmer active, the function will return -1. | 89 // no dimmer active, the function will return -1. |
| 88 int GetDimmingAlphaForTest(); | 90 int GetDimmingAlphaForTest(); |
| 89 | 91 |
| 90 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if | 92 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if |
| 91 // the dimmer is inactive. | 93 // the dimmer is inactive. |
| 92 gfx::Rect GetDimmerBoundsForTest(); | 94 gfx::Rect GetDimmerBoundsForTest(); |
| 93 | 95 |
| 94 // Disable dimming animations for running tests. | 96 // Disable dimming animations for running tests. |
| 95 void DisableDimmingAnimationsForTest(); | 97 void DisableDimmingAnimationsForTest(); |
| 96 | 98 |
| 99 // ShelfBackgroundAnimatorObserver overrides: |
| 100 void UpdateShelfItemBackground(int alpha) override; |
| 101 |
| 97 // ShelfLayoutManagerObserver overrides: | 102 // ShelfLayoutManagerObserver overrides: |
| 98 void WillDeleteShelfLayoutManager() override; | 103 void WillDeleteShelfLayoutManager() override; |
| 99 | 104 |
| 100 private: | 105 private: |
| 101 class DelegateView; | 106 class DelegateView; |
| 102 | 107 |
| 103 // views::Widget: | 108 // views::Widget: |
| 104 void OnMouseEvent(ui::MouseEvent* event) override; | 109 void OnMouseEvent(ui::MouseEvent* event) override; |
| 105 void OnGestureEvent(ui::GestureEvent* event) override; | 110 void OnGestureEvent(ui::GestureEvent* event) override; |
| 106 | 111 |
| 112 WmShelfAura* wm_shelf_aura_; |
| 113 |
| 107 // Owned by the shelf container's aura::Window. | 114 // Owned by the shelf container's aura::Window. |
| 108 ShelfLayoutManager* shelf_layout_manager_; | 115 ShelfLayoutManager* shelf_layout_manager_; |
| 109 std::unique_ptr<Shelf> shelf_; | 116 std::unique_ptr<Shelf> shelf_; |
| 110 StatusAreaWidget* status_area_widget_; | 117 StatusAreaWidget* status_area_widget_; |
| 111 | 118 |
| 112 // |delegate_view_| is the contents view of this widget and is cleaned up | 119 // |delegate_view_| is the contents view of this widget and is cleaned up |
| 113 // during CloseChildWindows of the associated RootWindowController. | 120 // during CloseChildWindows of the associated RootWindowController. |
| 114 DelegateView* delegate_view_; | 121 DelegateView* delegate_view_; |
| 115 BackgroundAnimator background_animator_; | 122 ShelfBackgroundAnimator background_animator_; |
| 116 bool activating_as_fallback_; | 123 bool activating_as_fallback_; |
| 117 | 124 |
| 118 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); | 125 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); |
| 119 }; | 126 }; |
| 120 | 127 |
| 121 } // namespace ash | 128 } // namespace ash |
| 122 | 129 |
| 123 #endif // ASH_SHELF_SHELF_WIDGET_H_ | 130 #endif // ASH_SHELF_SHELF_WIDGET_H_ |
| OLD | NEW |