| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ |
| 6 #define ASH_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ | 6 #define ASH_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 public: | 40 public: |
| 41 static const char | 41 static const char |
| 42 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[]; | 42 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[]; |
| 43 | 43 |
| 44 ShelfButtonPressedMetricTracker(); | 44 ShelfButtonPressedMetricTracker(); |
| 45 ~ShelfButtonPressedMetricTracker(); | 45 ~ShelfButtonPressedMetricTracker(); |
| 46 | 46 |
| 47 // Records metrics based on the |event|, |sender|, and |performed_action|. | 47 // Records metrics based on the |event|, |sender|, and |performed_action|. |
| 48 void ButtonPressed(const ui::Event& event, | 48 void ButtonPressed(const ui::Event& event, |
| 49 const views::Button* sender, | 49 const views::Button* sender, |
| 50 ShelfItemDelegate::PerformedAction performed_action); | 50 ShelfAction performed_action); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 friend class test::ShelfButtonPressedMetricTrackerTestAPI; | 53 friend class test::ShelfButtonPressedMetricTrackerTestAPI; |
| 54 | 54 |
| 55 // Records UMA metrics for the input source when a button is pressed. | 55 // Records UMA metrics for the input source when a button is pressed. |
| 56 void RecordButtonPressedSource(const ui::Event& event); | 56 void RecordButtonPressedSource(const ui::Event& event); |
| 57 | 57 |
| 58 // Records UMA metrics for the action performed when a button is pressed. | 58 // Records UMA metrics for the action performed when a button is pressed. |
| 59 void RecordButtonPressedAction( | 59 void RecordButtonPressedAction(ShelfAction performed_action); |
| 60 ShelfItemDelegate::PerformedAction performed_action); | |
| 61 | 60 |
| 62 // Records UMA metrics for the elapsed time since the last window minimize | 61 // Records UMA metrics for the elapsed time since the last window minimize |
| 63 // action. | 62 // action. |
| 64 void RecordTimeBetweenMinimizedAndActivated(); | 63 void RecordTimeBetweenMinimizedAndActivated(); |
| 65 | 64 |
| 66 // Returns true if a window activation action triggered by |sender| would | 65 // Returns true if a window activation action triggered by |sender| would |
| 67 // be subsequent to the last minimize window action. | 66 // be subsequent to the last minimize window action. |
| 68 bool IsSubsequentActivationEvent(const views::Button* sender) const; | 67 bool IsSubsequentActivationEvent(const views::Button* sender) const; |
| 69 | 68 |
| 70 // Caches state data for a window minimized action. The |sender| is the button | 69 // Caches state data for a window minimized action. The |sender| is the button |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 // Stores the source button of the last window minimize action. | 82 // Stores the source button of the last window minimize action. |
| 84 // NOTE: This may become stale and should not be operated on. Not owned. | 83 // NOTE: This may become stale and should not be operated on. Not owned. |
| 85 const views::Button* last_minimized_source_button_; | 84 const views::Button* last_minimized_source_button_; |
| 86 | 85 |
| 87 DISALLOW_COPY_AND_ASSIGN(ShelfButtonPressedMetricTracker); | 86 DISALLOW_COPY_AND_ASSIGN(ShelfButtonPressedMetricTracker); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 } // namespace ash | 89 } // namespace ash |
| 91 | 90 |
| 92 #endif // ASH_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ | 91 #endif // ASH_COMMON_SHELF_SHELF_BUTTON_PRESSED_METRIC_TRACKER_H_ |
| OLD | NEW |