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

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

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Fixed nits. Created 3 years, 5 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
« no previous file with comments | « ash/system/tray/system_tray_unittest.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 <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/shelf/shelf_background_animator_observer.h" 11 #include "ash/shelf/shelf_background_animator_observer.h"
12 #include "ash/system/tray/actionable_view.h" 12 #include "ash/system/tray/actionable_view.h"
13 #include "ash/system/tray_drag_controller.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "ui/compositor/layer_animation_observer.h" 15 #include "ui/compositor/layer_animation_observer.h"
15 #include "ui/gfx/geometry/insets.h" 16 #include "ui/gfx/geometry/insets.h"
16 #include "ui/views/bubble/tray_bubble_view.h" 17 #include "ui/views/bubble/tray_bubble_view.h"
17 18
18 namespace ash { 19 namespace ash {
19 class Shelf; 20 class Shelf;
20 class TrayBackground; 21 class TrayBackground;
21 class TrayContainer; 22 class TrayContainer;
22 class TrayEventFilter; 23 class TrayEventFilter;
23 24
24 // Base class for some children of StatusAreaWidget. This class handles setting 25 // Base class for some children of StatusAreaWidget. This class handles setting
25 // and animating the background when the Launcher is shown/hidden. It also 26 // and animating the background when the Launcher is shown/hidden. It also
26 // inherits from ActionableView so that the tray items can override 27 // inherits from ActionableView so that the tray items can override
27 // PerformAction when clicked on. 28 // PerformAction when clicked on.
28 class ASH_EXPORT TrayBackgroundView : public ActionableView, 29 class ASH_EXPORT TrayBackgroundView : public ActionableView,
29 public ui::ImplicitAnimationObserver, 30 public ui::ImplicitAnimationObserver,
30 public ShelfBackgroundAnimatorObserver { 31 public ShelfBackgroundAnimatorObserver,
32 public views::TrayBubbleView::Delegate {
31 public: 33 public:
32 static const char kViewClassName[]; 34 static const char kViewClassName[];
33 35
34 explicit TrayBackgroundView(Shelf* shelf); 36 explicit TrayBackgroundView(Shelf* shelf);
35 ~TrayBackgroundView() override; 37 ~TrayBackgroundView() override;
36 38
37 // Called after the tray has been added to the widget containing it. 39 // Called after the tray has been added to the widget containing it.
38 virtual void Initialize(); 40 virtual void Initialize();
39 41
40 // Initializes animations for the bubble. 42 // Initializes animations for the bubble.
41 static void InitializeBubbleAnimations(views::Widget* bubble_widget); 43 static void InitializeBubbleAnimations(views::Widget* bubble_widget);
42 44
43 // views::View: 45 // views::View:
44 void SetVisible(bool visible) override; 46 void SetVisible(bool visible) override;
45 const char* GetClassName() const override; 47 const char* GetClassName() const override;
48 void OnGestureEvent(ui::GestureEvent* event) override;
49 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
50 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
46 void ChildPreferredSizeChanged(views::View* child) override; 51 void ChildPreferredSizeChanged(views::View* child) override;
47 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
48 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
49 52
50 // ActionableView: 53 // ActionableView:
51 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; 54 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
52 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 55 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
53 const override; 56 const override;
54 void PaintButtonContents(gfx::Canvas* canvas) override; 57 void PaintButtonContents(gfx::Canvas* canvas) override;
55 58
59 // TrayBubbleView::Delegate:
60 void ProcessGestureEventForBubble(ui::GestureEvent* event) override;
61
62 // Returns the associated tray bubble view, if one exists. Otherwise returns
63 // nullptr.
64 virtual views::TrayBubbleView* GetBubbleView();
65
66 // Closes the associated tray bubble view if it exists and is currently
67 // showing.
68 virtual void CloseBubble();
69
70 // Shows the associated tray bubble if one exists.
71 virtual void ShowBubble();
72
56 // Called whenever the shelf alignment changes. 73 // Called whenever the shelf alignment changes.
57 virtual void UpdateAfterShelfAlignmentChange(); 74 virtual void UpdateAfterShelfAlignmentChange();
58 75
59 // Called when the anchor (tray or bubble) may have moved or changed. 76 // Called when the anchor (tray or bubble) may have moved or changed.
60 virtual void AnchorUpdated() {} 77 virtual void AnchorUpdated();
61 78
62 // Called from GetAccessibleNodeData, must return a valid accessible name. 79 // Called from GetAccessibleNodeData, must return a valid accessible name.
63 virtual base::string16 GetAccessibleNameForTray() = 0; 80 virtual base::string16 GetAccessibleNameForTray() = 0;
64 81
65 // Called when the bubble is resized. 82 // Called when the bubble is resized.
66 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} 83 virtual void BubbleResized(const views::TrayBubbleView* bubble_view);
67 84
68 // Hides the bubble associated with |bubble_view|. Called when the widget 85 // Hides the bubble associated with |bubble_view|. Called when the widget
69 // is closed. 86 // is closed.
70 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; 87 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0;
71 88
72 // Called by the bubble wrapper when a click event occurs outside the bubble. 89 // Called by the bubble wrapper when a click event occurs outside the bubble.
73 // May close the bubble. 90 // May close the bubble.
74 virtual void ClickedOutsideBubble() = 0; 91 virtual void ClickedOutsideBubble() = 0;
75 92
76 // Returns the bubble anchor alignment based on |shelf_alignment_|. 93 // Returns the bubble anchor alignment based on |shelf_alignment_|.
(...skipping 16 matching lines...) Expand all
93 void set_separator_visibility(bool visible) { separator_visible_ = visible; } 110 void set_separator_visibility(bool visible) { separator_visible_ = visible; }
94 111
95 // Gets the anchor for bubbles, which is tray_container(). 112 // Gets the anchor for bubbles, which is tray_container().
96 views::View* GetBubbleAnchor() const; 113 views::View* GetBubbleAnchor() const;
97 114
98 // Gets additional insets for positioning bubbles relative to 115 // Gets additional insets for positioning bubbles relative to
99 // tray_container(). 116 // tray_container().
100 gfx::Insets GetBubbleAnchorInsets() const; 117 gfx::Insets GetBubbleAnchorInsets() const;
101 118
102 // Returns the container window for the bubble (on the proper display). 119 // Returns the container window for the bubble (on the proper display).
103 aura::Window* GetBubbleWindowContainer() const; 120 aura::Window* GetBubbleWindowContainer();
121
122 // Update the bounds of the associated tray bubble. Close the bubble if
123 // |close_bubble| is set.
124 void AnimateToTargetBounds(const gfx::Rect& target_bounds, bool close_bubble);
104 125
105 protected: 126 protected:
106 // ActionableView: 127 // ActionableView:
107 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; 128 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
108 bool ShouldEnterPushedState(const ui::Event& event) override; 129 bool ShouldEnterPushedState(const ui::Event& event) override;
109 bool PerformAction(const ui::Event& event) override; 130 bool PerformAction(const ui::Event& event) override;
110 void HandlePerformActionResult(bool action_performed, 131 void HandlePerformActionResult(bool action_performed,
111 const ui::Event& event) override; 132 const ui::Event& event) override;
112 133
134 TrayDragController* drag_controller() { return drag_controller_.get(); }
135 void set_drag_controller(
136 std::unique_ptr<TrayDragController> drag_controller) {
137 drag_controller_ = std::move(drag_controller);
138 }
139
113 private: 140 private:
114 class TrayWidgetObserver; 141 class TrayWidgetObserver;
115 142
116 // ui::ImplicitAnimationObserver: 143 // ui::ImplicitAnimationObserver:
117 void OnImplicitAnimationsCompleted() override; 144 void OnImplicitAnimationsCompleted() override;
118 bool RequiresNotificationWhenAnimatorDestroyed() const override; 145 bool RequiresNotificationWhenAnimatorDestroyed() const override;
119 146
120 // Applies transformations to the |layer()| to animate the view when 147 // Applies transformations to the |layer()| to animate the view when
121 // SetVisible(false) is called. 148 // SetVisible(false) is called.
122 void HideTransformation(); 149 void HideTransformation();
(...skipping 15 matching lines...) Expand all
138 TrayBackground* background_; 165 TrayBackground* background_;
139 166
140 // Determines if the view is active. This changes how the ink drop ripples 167 // Determines if the view is active. This changes how the ink drop ripples
141 // behave. 168 // behave.
142 bool is_active_; 169 bool is_active_;
143 170
144 // Visibility of this tray's separator which is a line of 1x32px and 4px to 171 // Visibility of this tray's separator which is a line of 1x32px and 4px to
145 // right of tray. 172 // right of tray.
146 bool separator_visible_; 173 bool separator_visible_;
147 174
175 // Handles touch drag gestures on the tray area and its associated bubble.
176 std::unique_ptr<TrayDragController> drag_controller_;
177
178 // Used in maximize mode to make sure the system tray bubble only be shown in
179 // work area.
180 std::unique_ptr<aura::Window> clipping_window_;
181
148 std::unique_ptr<TrayWidgetObserver> widget_observer_; 182 std::unique_ptr<TrayWidgetObserver> widget_observer_;
149 std::unique_ptr<TrayEventFilter> tray_event_filter_; 183 std::unique_ptr<TrayEventFilter> tray_event_filter_;
150 184
151 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 185 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
152 }; 186 };
153 187
154 } // namespace ash 188 } // namespace ash
155 189
156 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 190 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_unittest.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698