| 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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/shelf/background_animator.h" | 9 #include "ash/shelf/background_animator.h" |
| 10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
| 12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 13 #include "ui/views/widget/widget_observer.h" | 13 #include "ui/views/widget/widget_observer.h" |
| 14 | 14 |
| 15 namespace aura { | 15 namespace aura { |
| 16 class Window; | 16 class Window; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 class FocusCycler; |
| 20 class Shelf; | 21 class Shelf; |
| 21 | 22 class ShelfLayoutManager; |
| 22 namespace internal { | |
| 23 class FocusCycler; | |
| 24 class StatusAreaWidget; | 23 class StatusAreaWidget; |
| 25 class ShelfLayoutManager; | |
| 26 class WorkspaceController; | 24 class WorkspaceController; |
| 27 } | |
| 28 | 25 |
| 29 class ASH_EXPORT ShelfWidget : public views::Widget, | 26 class ASH_EXPORT ShelfWidget : public views::Widget, |
| 30 public views::WidgetObserver, | 27 public views::WidgetObserver, |
| 31 public ShelfLayoutManagerObserver { | 28 public ShelfLayoutManagerObserver { |
| 32 public: | 29 public: |
| 33 ShelfWidget( | 30 ShelfWidget(aura::Window* shelf_container, |
| 34 aura::Window* shelf_container, | 31 aura::Window* status_container, |
| 35 aura::Window* status_container, | 32 WorkspaceController* workspace_controller); |
| 36 internal::WorkspaceController* workspace_controller); | |
| 37 virtual ~ShelfWidget(); | 33 virtual ~ShelfWidget(); |
| 38 | 34 |
| 39 // Returns if shelf alignment option is enabled, and the user is able | 35 // Returns if shelf alignment option is enabled, and the user is able |
| 40 // to adjust the alignment (guest and supervised mode users cannot for | 36 // to adjust the alignment (guest and supervised mode users cannot for |
| 41 // example). | 37 // example). |
| 42 static bool ShelfAlignmentAllowed(); | 38 static bool ShelfAlignmentAllowed(); |
| 43 | 39 |
| 44 void SetAlignment(ShelfAlignment alignmnet); | 40 void SetAlignment(ShelfAlignment alignmnet); |
| 45 ShelfAlignment GetAlignment() const; | 41 ShelfAlignment GetAlignment() const; |
| 46 | 42 |
| 47 // Sets the shelf's background type. | 43 // Sets the shelf's background type. |
| 48 void SetPaintsBackground(ShelfBackgroundType background_type, | 44 void SetPaintsBackground(ShelfBackgroundType background_type, |
| 49 BackgroundAnimatorChangeType change_type); | 45 BackgroundAnimatorChangeType change_type); |
| 50 ShelfBackgroundType GetBackgroundType() const; | 46 ShelfBackgroundType GetBackgroundType() const; |
| 51 | 47 |
| 52 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). | 48 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). |
| 53 void SetDimsShelf(bool dimming); | 49 void SetDimsShelf(bool dimming); |
| 54 bool GetDimsShelf() const; | 50 bool GetDimsShelf() const; |
| 55 | 51 |
| 56 internal::ShelfLayoutManager* shelf_layout_manager() { | 52 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } |
| 57 return shelf_layout_manager_; | |
| 58 } | |
| 59 Shelf* shelf() const { return shelf_.get(); } | 53 Shelf* shelf() const { return shelf_.get(); } |
| 60 internal::StatusAreaWidget* status_area_widget() const { | 54 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } |
| 61 return status_area_widget_; | |
| 62 } | |
| 63 | 55 |
| 64 void CreateShelf(); | 56 void CreateShelf(); |
| 65 | 57 |
| 66 // Set visibility of the shelf. | 58 // Set visibility of the shelf. |
| 67 void SetShelfVisibility(bool visible); | 59 void SetShelfVisibility(bool visible); |
| 68 bool IsShelfVisible() const; | 60 bool IsShelfVisible() const; |
| 69 | 61 |
| 70 // Sets the focus cycler. Also adds the shelf to the cycle. | 62 // Sets the focus cycler. Also adds the shelf to the cycle. |
| 71 void SetFocusCycler(internal::FocusCycler* focus_cycler); | 63 void SetFocusCycler(FocusCycler* focus_cycler); |
| 72 internal::FocusCycler* GetFocusCycler(); | 64 FocusCycler* GetFocusCycler(); |
| 73 | 65 |
| 74 // Called by the activation delegate, before the shelf is activated | 66 // Called by the activation delegate, before the shelf is activated |
| 75 // when no other windows are visible. | 67 // when no other windows are visible. |
| 76 void WillActivateAsFallback() { activating_as_fallback_ = true; } | 68 void WillActivateAsFallback() { activating_as_fallback_ = true; } |
| 77 | 69 |
| 78 aura::Window* window_container() { return window_container_; } | 70 aura::Window* window_container() { return window_container_; } |
| 79 | 71 |
| 80 // TODO(harrym): Remove when Status Area Widget is a child view. | 72 // TODO(harrym): Remove when Status Area Widget is a child view. |
| 81 void ShutdownStatusAreaWidget(); | 73 void ShutdownStatusAreaWidget(); |
| 82 | 74 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 | 89 |
| 98 // Disable dimming animations for running tests. | 90 // Disable dimming animations for running tests. |
| 99 void DisableDimmingAnimationsForTest(); | 91 void DisableDimmingAnimationsForTest(); |
| 100 | 92 |
| 101 // ShelfLayoutManagerObserver overrides: | 93 // ShelfLayoutManagerObserver overrides: |
| 102 virtual void WillDeleteShelf() OVERRIDE; | 94 virtual void WillDeleteShelf() OVERRIDE; |
| 103 | 95 |
| 104 private: | 96 private: |
| 105 class DelegateView; | 97 class DelegateView; |
| 106 | 98 |
| 107 internal::ShelfLayoutManager* shelf_layout_manager_; | 99 ShelfLayoutManager* shelf_layout_manager_; |
| 108 scoped_ptr<Shelf> shelf_; | 100 scoped_ptr<Shelf> shelf_; |
| 109 internal::StatusAreaWidget* status_area_widget_; | 101 StatusAreaWidget* status_area_widget_; |
| 110 | 102 |
| 111 // delegate_view_ is attached to window_container_ and is cleaned up | 103 // delegate_view_ is attached to window_container_ and is cleaned up |
| 112 // during CloseChildWindows of the associated RootWindowController. | 104 // during CloseChildWindows of the associated RootWindowController. |
| 113 DelegateView* delegate_view_; | 105 DelegateView* delegate_view_; |
| 114 internal::BackgroundAnimator background_animator_; | 106 BackgroundAnimator background_animator_; |
| 115 bool activating_as_fallback_; | 107 bool activating_as_fallback_; |
| 116 aura::Window* window_container_; | 108 aura::Window* window_container_; |
| 117 }; | 109 }; |
| 118 | 110 |
| 119 } // namespace ash | 111 } // namespace ash |
| 120 | 112 |
| 121 #endif // ASH_SHELF_SHELF_WIDGET_H_ | 113 #endif // ASH_SHELF_SHELF_WIDGET_H_ |
| OLD | NEW |