Chromium Code Reviews| 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_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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 145 |
| 146 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 146 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
| 147 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 147 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
| 148 | 148 |
| 149 // Activates the system tray bubble. | 149 // Activates the system tray bubble. |
| 150 void ActivateBubble(); | 150 void ActivateBubble(); |
| 151 | 151 |
| 152 // ui::EventHandler: | 152 // ui::EventHandler: |
| 153 void OnGestureEvent(ui::GestureEvent* event) override; | 153 void OnGestureEvent(ui::GestureEvent* event) override; |
| 154 | 154 |
| 155 // Process a gesture event and updates the dragging state of the bubble when | |
| 156 // appropriate. Returns true if the gesture has been handled and it should not | |
| 157 // be processed any further, false otherwise. Note, the events may triggered | |
|
xdai1
2017/06/30 22:27:08
nit: may be triggered
minch1
2017/07/01 05:57:14
Done.
| |
| 158 // on system tray or system tray bubble. | |
| 159 bool ProcessGestureEvent(const ui::GestureEvent& event, bool is_on_bubble); | |
| 160 | |
| 155 gfx::Rect GetWorkAreaBoundsInScreen() const; | 161 gfx::Rect GetWorkAreaBoundsInScreen() const; |
| 156 | 162 |
| 157 private: | 163 private: |
| 158 friend class SystemTrayTestApi; | 164 friend class SystemTrayTestApi; |
| 159 class ActivationObserver; | 165 class ActivationObserver; |
| 160 | 166 |
| 161 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 167 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
| 162 void CloseBubble(const ui::KeyEvent& key_event); | 168 void CloseBubble(const ui::KeyEvent& key_event); |
| 163 | 169 |
| 164 // Activates the bubble and starts key navigation with the |key_event|. | 170 // Activates the bubble and starts key navigation with the |key_event|. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 195 void CloseSystemBubbleAndDeactivateSystemTray(); | 201 void CloseSystemBubbleAndDeactivateSystemTray(); |
| 196 | 202 |
| 197 // Records UMA metrics for the number of user-visible rows in the system menu | 203 // Records UMA metrics for the number of user-visible rows in the system menu |
| 198 // and the percentage of the work area height covered by the system menu. | 204 // and the percentage of the work area height covered by the system menu. |
| 199 void RecordSystemMenuMetrics(); | 205 void RecordSystemMenuMetrics(); |
| 200 | 206 |
| 201 // Overridden from ActionableView. | 207 // Overridden from ActionableView. |
| 202 bool PerformAction(const ui::Event& event) override; | 208 bool PerformAction(const ui::Event& event) override; |
| 203 | 209 |
| 204 // Gesture related functions: | 210 // Gesture related functions: |
| 205 bool ProcessGestureEvent(const ui::GestureEvent& event); | |
| 206 bool StartGestureDrag(const ui::GestureEvent& gesture); | 211 bool StartGestureDrag(const ui::GestureEvent& gesture); |
| 207 void UpdateGestureDrag(const ui::GestureEvent& gesture); | 212 void UpdateGestureDrag(const ui::GestureEvent& gesture); |
| 208 void CompleteGestureDrag(const ui::GestureEvent& gesture); | 213 void CompleteGestureDrag(const ui::GestureEvent& gesture); |
| 209 | 214 |
| 210 // Update the bounds of the system tray bubble according to |location|. Note | 215 // Update the bounds of the system tray bubble according to |
| 211 // that |location| is in the local coordinate space of |this|. | 216 // |gesture_drag_amount_|. |
| 212 void SetBubbleBounds(const gfx::Point& location); | 217 void SetBubbleBounds(); |
|
xdai1
2017/06/30 22:27:08
I think UpdateBubbleBounds() might better describe
minch1
2017/07/01 05:57:14
Done.
| |
| 213 | 218 |
| 214 // Return true if the system bubble should be shown (i.e., animated upward to | 219 // Return true if the system bubble should be shown (i.e., animated upward to |
| 215 // be made fully visible) after a sequence of scroll events terminated by | 220 // be made fully visible) after a sequence of scroll events terminated by |
| 216 // |sequence_end|. Otherwise return false, indicating that the | 221 // |sequence_end|. Otherwise return false, indicating that the |
| 217 // partially-visible system bubble should be animated downward and made fully | 222 // partially-visible system bubble should be animated downward and made fully |
| 218 // hidden. | 223 // hidden. |
| 219 bool ShouldShowSystemBubbleAfterScrollSequence( | 224 bool ShouldShowSystemBubbleAfterScrollSequence( |
| 220 const ui::GestureEvent& sequence_end); | 225 const ui::GestureEvent& sequence_end); |
| 221 | 226 |
| 222 // Shelf the system tray is in. | 227 // Shelf the system tray is in. |
| 223 Shelf* const shelf_; | 228 Shelf* const shelf_; |
| 224 | 229 |
| 225 // The original bounds of the system tray bubble. | 230 // The original bounds of the system tray bubble. |
| 226 gfx::Rect system_tray_bubble_bounds_; | 231 gfx::Rect system_tray_bubble_bounds_; |
| 227 | 232 |
| 228 // Tracks the amount of the drag. Only valid if |is_in_drag_| is true. | 233 // Tracks the amount of the drag. Only valid if |is_in_drag_| is true. |
| 229 float gesture_drag_amount_ = 0.f; | 234 float gesture_drag_amount_ = 0.f; |
| 230 | 235 |
| 231 // True if the user is in the process of gesture-dragging to open the system | 236 // True if the user is in the process of gesture-dragging to open the system |
| 232 // tray bubble, false otherwise. | 237 // tray bubble, false otherwise. |
| 233 bool is_in_drag_ = false; | 238 bool is_in_drag_ = false; |
| 234 | 239 |
| 240 // True if the dragging is on system tray bubble, false otherwise. Note, | |
| 241 // should always set this before ProcessGestureEvent. | |
| 242 bool is_on_bubble_ = false; | |
|
xdai1
2017/06/30 22:27:08
considering rename it to is_dragging_bubble_?
minch1
2017/07/01 05:57:13
There is another flag |is_in_drag_| for dragging s
| |
| 243 | |
| 235 // The web notification tray view that appears adjacent to this view. | 244 // The web notification tray view that appears adjacent to this view. |
| 236 WebNotificationTray* web_notification_tray_ = nullptr; | 245 WebNotificationTray* web_notification_tray_ = nullptr; |
| 237 | 246 |
| 238 // Items. | 247 // Items. |
| 239 std::vector<std::unique_ptr<SystemTrayItem>> items_; | 248 std::vector<std::unique_ptr<SystemTrayItem>> items_; |
| 240 | 249 |
| 241 // Pointers to members of |items_|. | 250 // Pointers to members of |items_|. |
| 242 SystemTrayItem* detailed_item_ = nullptr; | 251 SystemTrayItem* detailed_item_ = nullptr; |
| 243 | 252 |
| 244 // Bubble for default and detailed views. | 253 // Bubble for default and detailed views. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 272 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned | 281 ScreenTrayItem* screen_share_tray_item_ = nullptr; // not owned |
| 273 | 282 |
| 274 std::unique_ptr<ActivationObserver> activation_observer_; | 283 std::unique_ptr<ActivationObserver> activation_observer_; |
| 275 | 284 |
| 276 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 285 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 277 }; | 286 }; |
| 278 | 287 |
| 279 } // namespace ash | 288 } // namespace ash |
| 280 | 289 |
| 281 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 290 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |