| 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 #include "ash/shelf/shelf_button_pressed_metric_tracker.h" | 5 #include "ash/shelf/shelf_button_pressed_metric_tracker.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
| 10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 const char ShelfButtonPressedMetricTracker:: | 14 const char ShelfButtonPressedMetricTracker:: |
| 15 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[] = | 15 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName[] = |
| 16 "Ash.Shelf.TimeBetweenWindowMinimizedAndActivatedActions"; | 16 "Ash.Shelf.TimeBetweenWindowMinimizedAndActivatedActions"; |
| 17 | 17 |
| 18 ShelfButtonPressedMetricTracker::ShelfButtonPressedMetricTracker() | 18 ShelfButtonPressedMetricTracker::ShelfButtonPressedMetricTracker() |
| 19 : tick_clock_(new base::DefaultTickClock()), | 19 : tick_clock_(new base::DefaultTickClock()), |
| 20 time_of_last_minimize_(base::TimeTicks()), | 20 time_of_last_minimize_(base::TimeTicks()), |
| 21 last_minimized_source_button_(nullptr) { | 21 last_minimized_source_button_(nullptr) {} |
| 22 } | |
| 23 | 22 |
| 24 ShelfButtonPressedMetricTracker::~ShelfButtonPressedMetricTracker() { | 23 ShelfButtonPressedMetricTracker::~ShelfButtonPressedMetricTracker() {} |
| 25 } | |
| 26 | 24 |
| 27 void ShelfButtonPressedMetricTracker::ButtonPressed( | 25 void ShelfButtonPressedMetricTracker::ButtonPressed( |
| 28 const ui::Event& event, | 26 const ui::Event& event, |
| 29 const views::Button* sender, | 27 const views::Button* sender, |
| 30 ShelfItemDelegate::PerformedAction performed_action) { | 28 ShelfItemDelegate::PerformedAction performed_action) { |
| 31 RecordButtonPressedSource(event); | 29 RecordButtonPressedSource(event); |
| 32 RecordButtonPressedAction(performed_action); | 30 RecordButtonPressedAction(performed_action); |
| 33 | 31 |
| 34 switch (performed_action) { | 32 switch (performed_action) { |
| 35 case ShelfItemDelegate::kExistingWindowMinimized: | 33 case ShelfItemDelegate::kExistingWindowMinimized: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 last_minimized_source_button_ = sender; | 91 last_minimized_source_button_ = sender; |
| 94 time_of_last_minimize_ = tick_clock_->NowTicks(); | 92 time_of_last_minimize_ = tick_clock_->NowTicks(); |
| 95 } | 93 } |
| 96 | 94 |
| 97 void ShelfButtonPressedMetricTracker::ResetMinimizedData() { | 95 void ShelfButtonPressedMetricTracker::ResetMinimizedData() { |
| 98 last_minimized_source_button_ = nullptr; | 96 last_minimized_source_button_ = nullptr; |
| 99 time_of_last_minimize_ = base::TimeTicks(); | 97 time_of_last_minimize_ = base::TimeTicks(); |
| 100 } | 98 } |
| 101 | 99 |
| 102 } // namespace ash | 100 } // namespace ash |
| OLD | NEW |