| 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_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/launcher/background_animator.h" | 9 #include "ash/launcher/background_animator.h" |
| 10 #include "ash/system/tray/tray_views.h" | 10 #include "ash/system/tray/tray_views.h" |
| 11 #include "ash/wm/shelf_types.h" | 11 #include "ash/wm/shelf_types.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 class StatusAreaWidget; | 16 class StatusAreaWidget; |
| 17 class TrayBackground; | 17 class TrayBackground; |
| 18 class TrayLayerAnimationObserver; |
| 18 | 19 |
| 19 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. | 20 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. |
| 20 // This class handles setting and animating the background when the Launcher | 21 // This class handles setting and animating the background when the Launcher |
| 21 // his shown/hidden. It also inherits from ActionableView so that the tray | 22 // his shown/hidden. It also inherits from ActionableView so that the tray |
| 22 // items can override PerformAction when clicked on. | 23 // items can override PerformAction when clicked on. |
| 23 | 24 |
| 24 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, | 25 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, |
| 25 public BackgroundAnimatorDelegate { | 26 public BackgroundAnimatorDelegate { |
| 26 public: | 27 public: |
| 27 // Base class for tray containers. Sets the border and layout. The container | 28 // Base class for tray containers. Sets the border and layout. The container |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 ShelfAlignment alignment_; | 53 ShelfAlignment alignment_; |
| 53 gfx::Size size_; | 54 gfx::Size size_; |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(TrayContainer); | 56 DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget); | 59 explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget); |
| 59 virtual ~TrayBackgroundView(); | 60 virtual ~TrayBackgroundView(); |
| 60 | 61 |
| 62 // Called after the tray has been added to the widget containing it. |
| 63 virtual void Initialize(); |
| 64 |
| 61 // Overridden from views::View. | 65 // Overridden from views::View. |
| 62 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 66 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 63 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 67 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 64 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 68 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 69 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 70 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 71 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
| 65 | 72 |
| 66 // Overridden from internal::ActionableView. | 73 // Overridden from internal::ActionableView. |
| 67 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 74 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
| 68 | 75 |
| 69 // Overridden from internal::BackgroundAnimatorDelegate. | 76 // Overridden from internal::BackgroundAnimatorDelegate. |
| 70 virtual void UpdateBackground(int alpha) OVERRIDE; | 77 virtual void UpdateBackground(int alpha) OVERRIDE; |
| 71 | 78 |
| 72 // Called whenever the shelf alignment changes. | 79 // Called whenever the shelf alignment changes. |
| 73 virtual void SetShelfAlignment(ShelfAlignment alignment); | 80 virtual void SetShelfAlignment(ShelfAlignment alignment); |
| 74 | 81 |
| 82 // Called when the anchor (tray or bubble) may have moved or changed. |
| 83 virtual void AnchorUpdated() {} |
| 84 |
| 85 virtual string16 GetAccessibleName() = 0; |
| 86 |
| 75 // Sets |contents| as a child and sets its background to |background_|. | 87 // Sets |contents| as a child and sets its background to |background_|. |
| 76 void SetContents(views::View* contents); | 88 void SetContents(views::View* contents); |
| 77 | 89 |
| 78 // Sets whether the tray paints a background. Default is true, but is set to | 90 // Sets whether the tray paints a background. Default is true, but is set to |
| 79 // false if a window overlaps the shelf. | 91 // false if a window overlaps the shelf. |
| 80 void SetPaintsBackground( | 92 void SetPaintsBackground( |
| 81 bool value, | 93 bool value, |
| 82 internal::BackgroundAnimator::ChangeType change_type); | 94 internal::BackgroundAnimator::ChangeType change_type); |
| 83 | 95 |
| 84 // Called after all status area trays have been created. Sets the border | 96 // Called whenever the launcher auto-hide behavior may need updating. |
| 85 // based on the position of the view. | 97 void UpdateShouldShowLauncher(); |
| 86 void SetBorder(); | |
| 87 | 98 |
| 88 StatusAreaWidget* status_area_widget() { | 99 StatusAreaWidget* status_area_widget() { |
| 89 return status_area_widget_; | 100 return status_area_widget_; |
| 90 } | 101 } |
| 91 TrayContainer* tray_container() const { return tray_container_; } | 102 TrayContainer* tray_container() const { return tray_container_; } |
| 92 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 103 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
| 93 | 104 |
| 94 private: | 105 private: |
| 106 friend class TrayLayerAnimationObserver; |
| 107 |
| 108 // Called from Initialize after all status area trays have been created. |
| 109 // Sets the border based on the position of the view. |
| 110 void SetBorder(); |
| 111 |
| 95 // Unowned pointer to parent widget. | 112 // Unowned pointer to parent widget. |
| 96 StatusAreaWidget* status_area_widget_; | 113 StatusAreaWidget* status_area_widget_; |
| 97 | 114 |
| 98 // Convenience pointer to the contents view. | 115 // Convenience pointer to the contents view. |
| 99 TrayContainer* tray_container_; | 116 TrayContainer* tray_container_; |
| 100 | 117 |
| 101 // Shelf alignment. | 118 // Shelf alignment. |
| 102 ShelfAlignment shelf_alignment_; | 119 ShelfAlignment shelf_alignment_; |
| 103 | 120 |
| 104 // Owned by the view passed to SetContents(). | 121 // Owned by the view passed to SetContents(). |
| 105 internal::TrayBackground* background_; | 122 internal::TrayBackground* background_; |
| 106 | 123 |
| 107 internal::BackgroundAnimator hide_background_animator_; | 124 internal::BackgroundAnimator hide_background_animator_; |
| 108 internal::BackgroundAnimator hover_background_animator_; | 125 internal::BackgroundAnimator hover_background_animator_; |
| 126 scoped_ptr<internal::TrayLayerAnimationObserver> |
| 127 layer_animation_observer_; |
| 109 | 128 |
| 110 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 129 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 111 }; | 130 }; |
| 112 | 131 |
| 113 } // namespace internal | 132 } // namespace internal |
| 114 } // namespace ash | 133 } // namespace ash |
| 115 | 134 |
| 116 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 135 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |