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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 void OnMouseExitedView() override; | 135 void OnMouseExitedView() override; |
| 136 base::string16 GetAccessibleNameForBubble() override; | 136 base::string16 GetAccessibleNameForBubble() override; |
| 137 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 137 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| 138 | 138 |
| 139 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 139 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
| 140 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 140 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
| 141 | 141 |
| 142 // Activates the system tray bubble. | 142 // Activates the system tray bubble. |
| 143 void ActivateBubble(); | 143 void ActivateBubble(); |
| 144 | 144 |
| 145 // ui::EventHandler: | |
| 146 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 147 | |
| 148 gfx::Rect GetWorkAreaBoundsInScreen() const; | |
| 149 | |
| 145 private: | 150 private: |
| 146 friend class SystemTrayTestApi; | 151 friend class SystemTrayTestApi; |
| 147 class ActivationObserver; | 152 class ActivationObserver; |
| 148 | 153 |
| 149 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 154 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
| 150 void CloseBubble(const ui::KeyEvent& key_event); | 155 void CloseBubble(const ui::KeyEvent& key_event); |
| 151 | 156 |
| 152 // Activates the bubble and starts key navigation with the |key_event|. | 157 // Activates the bubble and starts key navigation with the |key_event|. |
| 153 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); | 158 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); |
| 154 | 159 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // Deactivate the system tray in the shelf if it was active before. | 191 // Deactivate the system tray in the shelf if it was active before. |
| 187 void CloseSystemBubbleAndDeactivateSystemTray(); | 192 void CloseSystemBubbleAndDeactivateSystemTray(); |
| 188 | 193 |
| 189 // Records UMA metrics for the number of user-visible rows in the system menu | 194 // Records UMA metrics for the number of user-visible rows in the system menu |
| 190 // and the percentage of the work area height covered by the system menu. | 195 // and the percentage of the work area height covered by the system menu. |
| 191 void RecordSystemMenuMetrics(); | 196 void RecordSystemMenuMetrics(); |
| 192 | 197 |
| 193 // Overridden from ActionableView. | 198 // Overridden from ActionableView. |
| 194 bool PerformAction(const ui::Event& event) override; | 199 bool PerformAction(const ui::Event& event) override; |
| 195 | 200 |
| 201 // Gesture related functions: | |
| 202 bool ProcessGestureEvent(const ui::GestureEvent& event); | |
| 203 bool StartGestureDrag(const ui::GestureEvent& gesture); | |
| 204 void UpdateGestureDrag(const ui::GestureEvent& gesture); | |
| 205 void CompleteGestureDrag(const ui::GestureEvent& gesture); | |
| 206 | |
| 207 // Returns true if swiping down triggered on the system tray area on the | |
| 208 // shelf. | |
| 209 bool IsDraggingDownOnShelf(const ui::GestureEvent& gesture); | |
| 210 | |
| 211 // Update the bounds of the system tray bubble according to the location of | |
| 212 // the gesture drag. | |
| 213 void UpdateBoundsOnDragging(const ui::GestureEvent& gesture); | |
| 214 | |
| 215 // For SCROLL event, open the system tray bubble if the drag amount is larger | |
| 216 // than one third of the height of the bubble. Otherwise, close it. For FLING | |
| 217 // event. If the fling velocity is larger than 100.0 dips/sec, open or close | |
| 218 // the bubble depends on the fling direction. Otherwise, the rule is the same | |
| 219 // as SCROLL event. | |
| 220 bool ShouldShowSystemBubbleForDragging(const ui::GestureEvent& gesture); | |
|
tdanderson
2017/06/20 22:42:28
With the current implementation, once the system m
minch1
2017/06/22 17:42:11
Done.
| |
| 221 | |
| 222 // Shelf the system tray is in. | |
| 223 Shelf* const shelf_; | |
| 224 | |
| 225 // The original bounds of the system tray bubble. | |
| 226 gfx::Rect system_tray_bubble_bounds_; | |
| 227 | |
| 228 // Tracks the amount of the drag. | |
| 229 float gesture_drag_amount_ = 0.f; | |
| 230 | |
| 196 // The web notification tray view that appears adjacent to this view. | 231 // The web notification tray view that appears adjacent to this view. |
| 197 WebNotificationTray* web_notification_tray_ = nullptr; | 232 WebNotificationTray* web_notification_tray_ = nullptr; |
| 198 | 233 |
| 199 // Items. | 234 // Items. |
| 200 std::vector<std::unique_ptr<SystemTrayItem>> items_; | 235 std::vector<std::unique_ptr<SystemTrayItem>> items_; |
| 201 | 236 |
| 202 // Pointers to members of |items_|. | 237 // Pointers to members of |items_|. |
| 203 SystemTrayItem* detailed_item_ = nullptr; | 238 SystemTrayItem* detailed_item_ = nullptr; |
| 204 | 239 |
| 205 // Bubble for default and detailed views. | 240 // Bubble for default and detailed views. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 235 std::unique_ptr<KeyEventWatcher> key_event_watcher_; | 270 std::unique_ptr<KeyEventWatcher> key_event_watcher_; |
| 236 | 271 |
| 237 std::unique_ptr<ActivationObserver> activation_observer_; | 272 std::unique_ptr<ActivationObserver> activation_observer_; |
| 238 | 273 |
| 239 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 274 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 240 }; | 275 }; |
| 241 | 276 |
| 242 } // namespace ash | 277 } // namespace ash |
| 243 | 278 |
| 244 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 279 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |