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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "ash/launcher/background_animator.h" | 10 #include "ash/launcher/background_animator.h" |
11 #include "ash/system/tray/tray_views.h" | 11 #include "ash/system/tray/tray_views.h" |
| 12 #include "ash/wm/shelf_auto_hide_behavior.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 class TrayBackground; | 17 class TrayBackground; |
17 | 18 |
18 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. | 19 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. |
19 // This class handles setting and animating the background when the Launcher | 20 // This class handles setting and animating the background when the Launcher |
20 // his shown/hidden. It also inherits from ActionableView so that the tray | 21 // his shown/hidden. It also inherits from ActionableView so that the tray |
21 // items can override PerformAction when clicked on. | 22 // items can override PerformAction when clicked on. |
22 | 23 |
23 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, | 24 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, |
24 public BackgroundAnimatorDelegate { | 25 public BackgroundAnimatorDelegate { |
25 public: | 26 public: |
26 TrayBackgroundView(); | 27 TrayBackgroundView(); |
27 virtual ~TrayBackgroundView(); | 28 virtual ~TrayBackgroundView(); |
28 | 29 |
29 // Overridden from views::View. | 30 // Overridden from views::View. |
30 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 31 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
31 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 32 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
32 | 33 |
33 // Overridden from internal::ActionableView. | 34 // Overridden from internal::ActionableView. |
34 virtual bool PerformAction(const views::Event& event) OVERRIDE; | 35 virtual bool PerformAction(const views::Event& event) OVERRIDE; |
35 | 36 |
36 // Overridden from internal::BackgroundAnimatorDelegate. | 37 // Overridden from internal::BackgroundAnimatorDelegate. |
37 virtual void UpdateBackground(int alpha) OVERRIDE; | 38 virtual void UpdateBackground(int alpha) OVERRIDE; |
38 | 39 |
| 40 // Called whenever the shelf alignment changes. |
| 41 virtual void SetShelfAlignment(ShelfAlignment alignment); |
| 42 |
39 // Sets |contents| as a child and sets its background to |background_|. | 43 // Sets |contents| as a child and sets its background to |background_|. |
40 void SetContents(views::View* contents); | 44 void SetContents(views::View* contents); |
41 | 45 |
42 // Sets whether the tray paints a background. Default is true, but is set to | 46 // Sets whether the tray paints a background. Default is true, but is set to |
43 // false if a window overlaps the shelf. | 47 // false if a window overlaps the shelf. |
44 void SetPaintsBackground( | 48 void SetPaintsBackground( |
45 bool value, | 49 bool value, |
46 internal::BackgroundAnimator::ChangeType change_type); | 50 internal::BackgroundAnimator::ChangeType change_type); |
47 | 51 |
| 52 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
| 53 |
48 private: | 54 private: |
| 55 // Shelf alignment. |
| 56 ShelfAlignment shelf_alignment_; |
| 57 |
49 // Owned by the view passed to SetContents(). | 58 // Owned by the view passed to SetContents(). |
50 internal::TrayBackground* background_; | 59 internal::TrayBackground* background_; |
51 | 60 |
52 internal::BackgroundAnimator hide_background_animator_; | 61 internal::BackgroundAnimator hide_background_animator_; |
53 internal::BackgroundAnimator hover_background_animator_; | 62 internal::BackgroundAnimator hover_background_animator_; |
54 | 63 |
55 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 64 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
56 }; | 65 }; |
57 | 66 |
58 } // namespace internal | 67 } // namespace internal |
59 } // namespace ash | 68 } // namespace ash |
60 | 69 |
61 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 70 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |