| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
| 6 | 6 |
| 7 #include "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/mru_window_tracker.h" | 9 #include "ash/wm/mru_window_tracker.h" |
| 10 #include "ash/wm/window_cycle_list.h" | 10 #include "ash/wm/window_cycle_list.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
| 13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Filter to watch for the termination of a keyboard gesture to cycle through | 19 // Filter to watch for the termination of a keyboard gesture to cycle through |
| 20 // multiple windows. | 20 // multiple windows. |
| 21 class WindowCycleEventFilter : public ui::EventHandler { | 21 class WindowCycleEventFilter : public ui::EventHandler { |
| 22 public: | 22 public: |
| 23 WindowCycleEventFilter(); | 23 WindowCycleEventFilter(); |
| 24 virtual ~WindowCycleEventFilter(); | 24 ~WindowCycleEventFilter() override; |
| 25 | 25 |
| 26 // Overridden from ui::EventHandler: | 26 // Overridden from ui::EventHandler: |
| 27 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 27 void OnKeyEvent(ui::KeyEvent* event) override; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); | 30 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 WindowCycleEventFilter::WindowCycleEventFilter() { | 33 WindowCycleEventFilter::WindowCycleEventFilter() { |
| 34 Shell::GetInstance()->AddPreTargetHandler(this); | 34 Shell::GetInstance()->AddPreTargetHandler(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 WindowCycleEventFilter::~WindowCycleEventFilter() { | 37 WindowCycleEventFilter::~WindowCycleEventFilter() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 void WindowCycleController::StopCycling() { | 95 void WindowCycleController::StopCycling() { |
| 96 window_cycle_list_.reset(); | 96 window_cycle_list_.reset(); |
| 97 // Remove our key event filter. | 97 // Remove our key event filter. |
| 98 event_handler_.reset(); | 98 event_handler_.reset(); |
| 99 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime", | 99 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime", |
| 100 base::Time::Now() - cycle_start_time_); | 100 base::Time::Now() - cycle_start_time_); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace ash | 103 } // namespace ash |
| OLD | NEW |