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 20 matching lines...) Expand all Loading... | |
| 31 class TrayNetwork; | 31 class TrayNetwork; |
| 32 class TrayNightLight; | 32 class TrayNightLight; |
| 33 class TrayScale; | 33 class TrayScale; |
| 34 class TraySessionLengthLimit; | 34 class TraySessionLengthLimit; |
| 35 class TraySupervisedUser; | 35 class TraySupervisedUser; |
| 36 class TraySystemInfo; | 36 class TraySystemInfo; |
| 37 class TrayTiles; | 37 class TrayTiles; |
| 38 class TrayUpdate; | 38 class TrayUpdate; |
| 39 class WebNotificationTray; | 39 class WebNotificationTray; |
| 40 | 40 |
| 41 // The threshold of the velocity of the fling event. | |
| 42 const float kFlingVelocity = 100.0f; | |
|
tdanderson
2017/06/22 20:21:43
as-is, this constant is being exposed to the entir
minch1
2017/06/23 22:39:57
Done.
| |
| 43 | |
| 41 // There are different methods for creating bubble views. | 44 // There are different methods for creating bubble views. |
| 42 enum BubbleCreationType { | 45 enum BubbleCreationType { |
| 43 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. | 46 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. | 47 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 class ASH_EXPORT SystemTray : public TrayBackgroundView, | 50 class ASH_EXPORT SystemTray : public TrayBackgroundView, |
| 48 public views::TrayBubbleView::Delegate { | 51 public views::TrayBubbleView::Delegate { |
| 49 public: | 52 public: |
| 50 explicit SystemTray(Shelf* shelf); | 53 explicit SystemTray(Shelf* shelf); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 void OnMouseExitedView() override; | 138 void OnMouseExitedView() override; |
| 136 base::string16 GetAccessibleNameForBubble() override; | 139 base::string16 GetAccessibleNameForBubble() override; |
| 137 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 140 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| 138 | 141 |
| 139 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 142 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
| 140 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 143 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
| 141 | 144 |
| 142 // Activates the system tray bubble. | 145 // Activates the system tray bubble. |
| 143 void ActivateBubble(); | 146 void ActivateBubble(); |
| 144 | 147 |
| 148 // ui::EventHandler: | |
| 149 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 150 | |
| 151 gfx::Rect GetWorkAreaBoundsInScreen() const; | |
| 152 | |
| 145 private: | 153 private: |
| 146 friend class SystemTrayTestApi; | 154 friend class SystemTrayTestApi; |
| 147 class ActivationObserver; | 155 class ActivationObserver; |
| 148 | 156 |
| 149 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. | 157 // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback. |
| 150 void CloseBubble(const ui::KeyEvent& key_event); | 158 void CloseBubble(const ui::KeyEvent& key_event); |
| 151 | 159 |
| 152 // Activates the bubble and starts key navigation with the |key_event|. | 160 // Activates the bubble and starts key navigation with the |key_event|. |
| 153 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); | 161 void ActivateAndStartNavigation(const ui::KeyEvent& key_event); |
| 154 | 162 |
| (...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. | 194 // Deactivate the system tray in the shelf if it was active before. |
| 187 void CloseSystemBubbleAndDeactivateSystemTray(); | 195 void CloseSystemBubbleAndDeactivateSystemTray(); |
| 188 | 196 |
| 189 // Records UMA metrics for the number of user-visible rows in the system menu | 197 // 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. | 198 // and the percentage of the work area height covered by the system menu. |
| 191 void RecordSystemMenuMetrics(); | 199 void RecordSystemMenuMetrics(); |
| 192 | 200 |
| 193 // Overridden from ActionableView. | 201 // Overridden from ActionableView. |
| 194 bool PerformAction(const ui::Event& event) override; | 202 bool PerformAction(const ui::Event& event) override; |
| 195 | 203 |
| 204 // Gesture related functions: | |
| 205 bool ProcessGestureEvent(const ui::GestureEvent& event); | |
| 206 bool StartGestureDrag(const ui::GestureEvent& gesture); | |
| 207 void UpdateGestureDrag(const ui::GestureEvent& gesture); | |
| 208 void CompleteGestureDrag(const ui::GestureEvent& gesture); | |
| 209 | |
| 210 // Update the bounds of the system tray bubble according to the location. | |
|
tdanderson
2017/06/22 20:21:42
nit: also specify that |location| is in the local
minch1
2017/06/23 22:39:57
Done.
| |
| 211 void SetBubbleBounds(gfx::Point* location); | |
| 212 | |
| 213 // Return true if the system bubble should be shown (i.e., animated upward to | |
| 214 // be made fully visible) after a sequence of scroll events terminated by | |
| 215 // |sequence_end|. Otherwise return false, indicating that the | |
| 216 // partially-visible system bubble should be animated downward and made fully | |
| 217 // hidden. | |
| 218 bool ShouldShowSystemBubbleAfterScrollSequence( | |
| 219 const ui::GestureEvent& gesture); | |
| 220 | |
| 221 // Shelf the system tray is in. | |
| 222 Shelf* const shelf_; | |
| 223 | |
| 224 // The original bounds of the system tray bubble. | |
| 225 gfx::Rect system_tray_bubble_bounds_; | |
| 226 | |
| 227 // Tracks the amount of the drag. | |
| 228 float gesture_drag_amount_ = 0.f; | |
| 229 | |
| 196 // The web notification tray view that appears adjacent to this view. | 230 // The web notification tray view that appears adjacent to this view. |
| 197 WebNotificationTray* web_notification_tray_ = nullptr; | 231 WebNotificationTray* web_notification_tray_ = nullptr; |
| 198 | 232 |
| 199 // Items. | 233 // Items. |
| 200 std::vector<std::unique_ptr<SystemTrayItem>> items_; | 234 std::vector<std::unique_ptr<SystemTrayItem>> items_; |
| 201 | 235 |
| 202 // Pointers to members of |items_|. | 236 // Pointers to members of |items_|. |
| 203 SystemTrayItem* detailed_item_ = nullptr; | 237 SystemTrayItem* detailed_item_ = nullptr; |
| 204 | 238 |
| 205 // Bubble for default and detailed views. | 239 // Bubble for default and detailed views. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 235 std::unique_ptr<KeyEventWatcher> key_event_watcher_; | 269 std::unique_ptr<KeyEventWatcher> key_event_watcher_; |
| 236 | 270 |
| 237 std::unique_ptr<ActivationObserver> activation_observer_; | 271 std::unique_ptr<ActivationObserver> activation_observer_; |
| 238 | 272 |
| 239 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 273 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 240 }; | 274 }; |
| 241 | 275 |
| 242 } // namespace ash | 276 } // namespace ash |
| 243 | 277 |
| 244 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 278 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |