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

Side by Side Diff: ash/system/tray/system_tray.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/palette/palette_tray.cc ('k') | ash/system/tray/system_tray.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_SYSTEM_TRAY_H_ 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 class TrayTracing; 37 class TrayTracing;
38 class TrayUpdate; 38 class TrayUpdate;
39 class WebNotificationTray; 39 class WebNotificationTray;
40 40
41 // There are different methods for creating bubble views. 41 // There are different methods for creating bubble views.
42 enum BubbleCreationType { 42 enum BubbleCreationType {
43 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. 43 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one.
44 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. 44 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one.
45 }; 45 };
46 46
47 class ASH_EXPORT SystemTray : public TrayBackgroundView, 47 class ASH_EXPORT SystemTray : public TrayBackgroundView {
48 public views::TrayBubbleView::Delegate {
49 public: 48 public:
50 // The threshold of the velocity of the fling event.
51 static constexpr float kFlingVelocity = 100.0f;
52 49
53 explicit SystemTray(Shelf* shelf); 50 explicit SystemTray(Shelf* shelf);
54 ~SystemTray() override; 51 ~SystemTray() override;
55 52
56 TrayUpdate* tray_update() { return tray_update_; } 53 TrayUpdate* tray_update() { return tray_update_; }
57 54
58 TrayNightLight* tray_night_light() { return tray_night_light_; } 55 TrayNightLight* tray_night_light() { return tray_night_light_; }
59 56
60 // Calls TrayBackgroundView::Initialize(), creates the tray items, and 57 // Calls TrayBackgroundView::Initialize(), creates the tray items, and
61 // adds them to SystemTrayNotifier. 58 // adds them to SystemTrayNotifier.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 104
108 // Returns true if the system_bubble_ exists and is of type |type|. 105 // Returns true if the system_bubble_ exists and is of type |type|.
109 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type); 106 bool HasSystemBubbleType(SystemTrayBubble::BubbleType type);
110 107
111 // Returns a pointer to the system bubble or NULL if none. 108 // Returns a pointer to the system bubble or NULL if none.
112 SystemTrayBubble* GetSystemBubble(); 109 SystemTrayBubble* GetSystemBubble();
113 110
114 // Returns true if system bubble is visible. 111 // Returns true if system bubble is visible.
115 bool IsSystemBubbleVisible() const; 112 bool IsSystemBubbleVisible() const;
116 113
114 // TODO(minch): Remove CloseSystemBubble which is redundant with CloseBubble.
115 // http://crbug.com/741953
117 // Closes system bubble and returns true if it did exist. 116 // Closes system bubble and returns true if it did exist.
118 bool CloseSystemBubble() const; 117 bool CloseSystemBubble() const;
119 118
120 // Returns view for help button if default view is shown. Returns NULL 119 // Returns view for help button if default view is shown. Returns NULL
121 // otherwise. 120 // otherwise.
122 views::View* GetHelpButtonView() const; 121 views::View* GetHelpButtonView() const;
123 122
124 // Returns TrayAudio object if present or null otherwise. 123 // Returns TrayAudio object if present or null otherwise.
125 TrayAudio* GetTrayAudio() const; 124 TrayAudio* GetTrayAudio() const;
126 125
127 // Overridden from TrayBackgroundView. 126 // TrayBackgroundView:
128 void UpdateAfterShelfAlignmentChange() override; 127 void UpdateAfterShelfAlignmentChange() override;
129 void AnchorUpdated() override; 128 void AnchorUpdated() override;
130 base::string16 GetAccessibleNameForTray() override; 129 base::string16 GetAccessibleNameForTray() override;
131 void BubbleResized(const views::TrayBubbleView* bubble_view) override; 130 void BubbleResized(const views::TrayBubbleView* bubble_view) override;
132 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; 131 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
133 void ClickedOutsideBubble() override; 132 void ClickedOutsideBubble() override;
133 bool PerformAction(const ui::Event& event) override;
134 void CloseBubble() override;
135 void ShowBubble() override;
136 views::TrayBubbleView* GetBubbleView() override;
134 137
135 // views::TrayBubbleView::Delegate: 138 // views::TrayBubbleView::Delegate:
136 void BubbleViewDestroyed() override; 139 void BubbleViewDestroyed() override;
137 void OnMouseEnteredView() override; 140 void OnMouseEnteredView() override;
138 void OnMouseExitedView() override; 141 void OnMouseExitedView() override;
139 void RegisterAccelerators(const std::vector<ui::Accelerator>& accelerators, 142 void RegisterAccelerators(const std::vector<ui::Accelerator>& accelerators,
140 views::TrayBubbleView* tray_bubble_view) override; 143 views::TrayBubbleView* tray_bubble_view) override;
141 void UnregisterAllAccelerators( 144 void UnregisterAllAccelerators(
142 views::TrayBubbleView* tray_bubble_view) override; 145 views::TrayBubbleView* tray_bubble_view) override;
143 base::string16 GetAccessibleNameForBubble() override; 146 base::string16 GetAccessibleNameForBubble() override;
144 bool ShouldEnableExtraKeyboardAccessibility() override; 147 bool ShouldEnableExtraKeyboardAccessibility() override;
145 void HideBubble(const views::TrayBubbleView* bubble_view) override; 148 void HideBubble(const views::TrayBubbleView* bubble_view) override;
146 149
147 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } 150 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; }
148 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } 151 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; }
149 152
150 // Activates the system tray bubble. 153 // Activates the system tray bubble.
151 void ActivateBubble(); 154 void ActivateBubble();
152 155
153 // ui::EventHandler:
154 void OnGestureEvent(ui::GestureEvent* event) override;
155
156 gfx::Rect GetWorkAreaBoundsInScreen() const;
157
158 private: 156 private:
159 friend class SystemTrayTestApi; 157 friend class SystemTrayTestApi;
160 class ActivationObserver; 158 class ActivationObserver;
161 159
162 // Activates the bubble and starts key navigation with the |key_event|. 160 // Activates the bubble and starts key navigation with the |key_event|.
163 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); 161 void ActivateAndStartNavigation(const ui::KeyEvent& key_event);
164 162
165 // Creates the default set of items for the sytem tray. 163 // Creates the default set of items for the sytem tray.
166 void CreateItems(SystemTrayDelegate* delegate); 164 void CreateItems(SystemTrayDelegate* delegate);
167 165
(...skipping 21 matching lines...) Expand all
189 // notification tray according to the current status. 187 // notification tray according to the current status.
190 void UpdateWebNotifications(); 188 void UpdateWebNotifications();
191 189
192 // Deactivate the system tray in the shelf if it was active before. 190 // Deactivate the system tray in the shelf if it was active before.
193 void CloseSystemBubbleAndDeactivateSystemTray(); 191 void CloseSystemBubbleAndDeactivateSystemTray();
194 192
195 // Records UMA metrics for the number of user-visible rows in the system menu 193 // Records UMA metrics for the number of user-visible rows in the system menu
196 // and the percentage of the work area height covered by the system menu. 194 // and the percentage of the work area height covered by the system menu.
197 void RecordSystemMenuMetrics(); 195 void RecordSystemMenuMetrics();
198 196
199 // Overridden from ActionableView.
200 bool PerformAction(const ui::Event& event) override;
201
202 // Gesture related functions:
203 bool ProcessGestureEvent(const ui::GestureEvent& event);
204 bool StartGestureDrag(const ui::GestureEvent& gesture);
205 void UpdateGestureDrag(const ui::GestureEvent& gesture);
206 void CompleteGestureDrag(const ui::GestureEvent& gesture);
207
208 // Update the bounds of the system tray bubble according to |location|. Note
209 // that |location| is in the local coordinate space of |this|.
210 void SetBubbleBounds(const gfx::Point& location);
211
212 // Return true if the system bubble should be shown (i.e., animated upward to
213 // be made fully visible) after a sequence of scroll events terminated by
214 // |sequence_end|. Otherwise return false, indicating that the
215 // partially-visible system bubble should be animated downward and made fully
216 // hidden.
217 bool ShouldShowSystemBubbleAfterScrollSequence(
218 const ui::GestureEvent& sequence_end);
219
220 // Shelf the system tray is in.
221 Shelf* const shelf_;
222
223 // The original bounds of the system tray bubble.
224 gfx::Rect system_tray_bubble_bounds_;
225
226 // Tracks the amount of the drag. Only valid if |is_in_drag_| is true.
227 float gesture_drag_amount_ = 0.f;
228
229 // True if the user is in the process of gesture-dragging to open the system
230 // tray bubble, false otherwise.
231 bool is_in_drag_ = false;
232
233 // The web notification tray view that appears adjacent to this view. 197 // The web notification tray view that appears adjacent to this view.
234 WebNotificationTray* web_notification_tray_ = nullptr; 198 WebNotificationTray* web_notification_tray_ = nullptr;
235 199
236 // Items. 200 // Items.
237 std::vector<std::unique_ptr<SystemTrayItem>> items_; 201 std::vector<std::unique_ptr<SystemTrayItem>> items_;
238 202
239 // Pointers to members of |items_|. 203 // Pointers to members of |items_|.
240 SystemTrayItem* detailed_item_ = nullptr; 204 SystemTrayItem* detailed_item_ = nullptr;
241 205
242 // Bubble for default and detailed views. 206 // Bubble for default and detailed views.
(...skipping 28 matching lines...) Expand all
271 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned 235 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned
272 236
273 std::unique_ptr<ActivationObserver> activation_observer_; 237 std::unique_ptr<ActivationObserver> activation_observer_;
274 238
275 DISALLOW_COPY_AND_ASSIGN(SystemTray); 239 DISALLOW_COPY_AND_ASSIGN(SystemTray);
276 }; 240 };
277 241
278 } // namespace ash 242 } // namespace ash
279 243
280 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ 244 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW
« no previous file with comments | « ash/system/palette/palette_tray.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698