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

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

Issue 515573002: Use active state on touch start for tray icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement Touch Feedback on TrayBackgroundView Created 6 years, 3 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
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/shelf/background_animator.h" 9 #include "ash/shelf/background_animator.h"
10 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
11 #include "ash/shell_observer.h"
11 #include "ash/system/tray/actionable_view.h" 12 #include "ash/system/tray/actionable_view.h"
12 #include "ui/compositor/layer_animation_observer.h" 13 #include "ui/compositor/layer_animation_observer.h"
13 #include "ui/views/bubble/tray_bubble_view.h" 14 #include "ui/views/bubble/tray_bubble_view.h"
14 15
15 namespace ash { 16 namespace ash {
16 class ShelfLayoutManager; 17 class ShelfLayoutManager;
17 class StatusAreaWidget; 18 class StatusAreaWidget;
18 class TrayEventFilter; 19 class TrayEventFilter;
19 class TrayBackground; 20 class TrayBackground;
20 21
21 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, 22 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray,
22 // LogoutButtonTray, OverviewButtonTray. 23 // LogoutButtonTray, OverviewButtonTray.
23 // This class handles setting and animating the background when the Launcher 24 // This class handles setting and animating the background when the Launcher
24 // his shown/hidden. It also inherits from ActionableView so that the tray 25 // his shown/hidden. It also inherits from ActionableView so that the tray
25 // items can override PerformAction when clicked on. 26 // items can override PerformAction when clicked on.
26 class ASH_EXPORT TrayBackgroundView : public ActionableView, 27 class ASH_EXPORT TrayBackgroundView : public ActionableView,
27 public BackgroundAnimatorDelegate, 28 public BackgroundAnimatorDelegate,
28 public ui::ImplicitAnimationObserver { 29 public ui::ImplicitAnimationObserver,
30 public ShellObserver {
29 public: 31 public:
30 static const char kViewClassName[]; 32 static const char kViewClassName[];
31 33
32 // Base class for tray containers. Sets the border and layout. The container 34 // Base class for tray containers. Sets the border and layout. The container
33 // auto-resizes the widget when necessary. 35 // auto-resizes the widget when necessary.
34 class TrayContainer : public views::View { 36 class TrayContainer : public views::View {
35 public: 37 public:
36 explicit TrayContainer(ShelfAlignment alignment); 38 explicit TrayContainer(ShelfAlignment alignment);
37 virtual ~TrayContainer() {} 39 virtual ~TrayContainer() {}
38 40
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual const char* GetClassName() const OVERRIDE; 72 virtual const char* GetClassName() const OVERRIDE;
71 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; 73 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
72 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; 74 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
73 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; 75 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
74 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; 76 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
75 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; 77 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
76 78
77 // ActionableView: 79 // ActionableView:
78 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 80 virtual bool PerformAction(const ui::Event& event) OVERRIDE;
79 virtual gfx::Rect GetFocusBounds() OVERRIDE; 81 virtual gfx::Rect GetFocusBounds() OVERRIDE;
82 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
80 83
81 // BackgroundAnimatorDelegate: 84 // BackgroundAnimatorDelegate:
82 virtual void UpdateBackground(int alpha) OVERRIDE; 85 virtual void UpdateBackground(int alpha) OVERRIDE;
83 86
87 // ShellObserver:
88 virtual void OnMaximizeModeStarted() OVERRIDE;
89 virtual void OnMaximizeModeEnded() OVERRIDE;
90
84 // Called whenever the shelf alignment changes. 91 // Called whenever the shelf alignment changes.
85 virtual void SetShelfAlignment(ShelfAlignment alignment); 92 virtual void SetShelfAlignment(ShelfAlignment alignment);
86 93
87 // Called when the anchor (tray or bubble) may have moved or changed. 94 // Called when the anchor (tray or bubble) may have moved or changed.
88 virtual void AnchorUpdated() {} 95 virtual void AnchorUpdated() {}
89 96
90 // Called from GetAccessibleState, must return a valid accessible name. 97 // Called from GetAccessibleState, must return a valid accessible name.
91 virtual base::string16 GetAccessibleNameForTray() = 0; 98 virtual base::string16 GetAccessibleNameForTray() = 0;
92 99
93 // Called when the bubble is resized. 100 // Called when the bubble is resized.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 BackgroundAnimator hide_background_animator_; 185 BackgroundAnimator hide_background_animator_;
179 BackgroundAnimator hover_background_animator_; 186 BackgroundAnimator hover_background_animator_;
180 187
181 // True if the background gets hovered. 188 // True if the background gets hovered.
182 bool hovered_; 189 bool hovered_;
183 190
184 // This variable stores the activation override which will tint the background 191 // This variable stores the activation override which will tint the background
185 // differently if set to true. 192 // differently if set to true.
186 bool draw_background_as_active_; 193 bool draw_background_as_active_;
187 194
195 // True if maximize mode is enabled, and touch view feedback has been enabled.
196 // When enabled touch gestures will toggle rendering the background as active.
197 bool touch_feedback_enabled_;
198
188 scoped_ptr<TrayWidgetObserver> widget_observer_; 199 scoped_ptr<TrayWidgetObserver> widget_observer_;
189 scoped_ptr<TrayEventFilter> tray_event_filter_; 200 scoped_ptr<TrayEventFilter> tray_event_filter_;
190 201
191 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 202 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
192 }; 203 };
193 204
194 } // namespace ash 205 } // namespace ash
195 206
196 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 207 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698