Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: ash/system/tray/tray_background_view.h

Issue 10854175: Revert 151752 - Move non SystemTray specific code to TrayBackgroundView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
19 18
20 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. 19 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray.
21 // This class handles setting and animating the background when the Launcher 20 // This class handles setting and animating the background when the Launcher
22 // 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
23 // items can override PerformAction when clicked on. 22 // items can override PerformAction when clicked on.
24 23
25 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, 24 class ASH_EXPORT TrayBackgroundView : public internal::ActionableView,
26 public BackgroundAnimatorDelegate { 25 public BackgroundAnimatorDelegate {
27 public: 26 public:
28 // Base class for tray containers. Sets the border and layout. The container 27 // Base class for tray containers. Sets the border and layout. The container
(...skipping 23 matching lines...) Expand all
52 51
53 ShelfAlignment alignment_; 52 ShelfAlignment alignment_;
54 gfx::Size size_; 53 gfx::Size size_;
55 54
56 DISALLOW_COPY_AND_ASSIGN(TrayContainer); 55 DISALLOW_COPY_AND_ASSIGN(TrayContainer);
57 }; 56 };
58 57
59 explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget); 58 explicit TrayBackgroundView(internal::StatusAreaWidget* status_area_widget);
60 virtual ~TrayBackgroundView(); 59 virtual ~TrayBackgroundView();
61 60
62 // Called after the tray has been added to the widget containing it.
63 virtual void Initialize();
64
65 // Overridden from views::View. 61 // Overridden from views::View.
66 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; 62 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
67 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; 63 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
68 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; 64 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
69 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
70 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
71 65
72 // Overridden from internal::ActionableView. 66 // Overridden from internal::ActionableView.
73 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 67 virtual bool PerformAction(const ui::Event& event) OVERRIDE;
74 68
75 // Overridden from internal::BackgroundAnimatorDelegate. 69 // Overridden from internal::BackgroundAnimatorDelegate.
76 virtual void UpdateBackground(int alpha) OVERRIDE; 70 virtual void UpdateBackground(int alpha) OVERRIDE;
77 71
78 // Called whenever the shelf alignment changes. 72 // Called whenever the shelf alignment changes.
79 virtual void SetShelfAlignment(ShelfAlignment alignment); 73 virtual void SetShelfAlignment(ShelfAlignment alignment);
80 74
81 // Called when the anchor (tray or bubble) may have moved or changed.
82 virtual void AnchorUpdated() {}
83
84 // Sets |contents| as a child and sets its background to |background_|. 75 // Sets |contents| as a child and sets its background to |background_|.
85 void SetContents(views::View* contents); 76 void SetContents(views::View* contents);
86 77
87 // Sets whether the tray paints a background. Default is true, but is set to 78 // Sets whether the tray paints a background. Default is true, but is set to
88 // false if a window overlaps the shelf. 79 // false if a window overlaps the shelf.
89 void SetPaintsBackground( 80 void SetPaintsBackground(
90 bool value, 81 bool value,
91 internal::BackgroundAnimator::ChangeType change_type); 82 internal::BackgroundAnimator::ChangeType change_type);
92 83
84 // Called after all status area trays have been created. Sets the border
85 // based on the position of the view.
86 void SetBorder();
87
93 StatusAreaWidget* status_area_widget() { 88 StatusAreaWidget* status_area_widget() {
94 return status_area_widget_; 89 return status_area_widget_;
95 } 90 }
96 TrayContainer* tray_container() const { return tray_container_; } 91 TrayContainer* tray_container() const { return tray_container_; }
97 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } 92 ShelfAlignment shelf_alignment() const { return shelf_alignment_; }
98 93
99 private: 94 private:
100 friend class TrayLayerAnimationObserver;
101
102 // Called from Initialize after all status area trays have been created.
103 // Sets the border based on the position of the view.
104 void SetBorder();
105
106 // Unowned pointer to parent widget. 95 // Unowned pointer to parent widget.
107 StatusAreaWidget* status_area_widget_; 96 StatusAreaWidget* status_area_widget_;
108 97
109 // Convenience pointer to the contents view. 98 // Convenience pointer to the contents view.
110 TrayContainer* tray_container_; 99 TrayContainer* tray_container_;
111 100
112 // Shelf alignment. 101 // Shelf alignment.
113 ShelfAlignment shelf_alignment_; 102 ShelfAlignment shelf_alignment_;
114 103
115 // Owned by the view passed to SetContents(). 104 // Owned by the view passed to SetContents().
116 internal::TrayBackground* background_; 105 internal::TrayBackground* background_;
117 106
118 internal::BackgroundAnimator hide_background_animator_; 107 internal::BackgroundAnimator hide_background_animator_;
119 internal::BackgroundAnimator hover_background_animator_; 108 internal::BackgroundAnimator hover_background_animator_;
120 scoped_ptr<internal::TrayLayerAnimationObserver>
121 layer_animation_observer_;
122 109
123 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 110 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
124 }; 111 };
125 112
126 } // namespace internal 113 } // namespace internal
127 } // namespace ash 114 } // namespace ash
128 115
129 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 116 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698