Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: ash/accelerators/accelerator_router.h

Issue 2901413005: [mus+ash] Removes WmWindow from ash/accelerators (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash/accelerators (rebased) Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/accelerators/accelerator_delegate.cc ('k') | ash/accelerators/accelerator_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ACCELERATORS_ACCELERATOR_ROUTER_H_ 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_ROUTER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_ROUTER_H_ 6 #define ASH_ACCELERATORS_ACCELERATOR_ROUTER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 11
12 namespace aura {
13 class Window;
14 }
15
12 namespace ui { 16 namespace ui {
13 class Accelerator; 17 class Accelerator;
14 class KeyEvent; 18 class KeyEvent;
15 } 19 }
16 20
17 namespace ash { 21 namespace ash {
18 22
19 class WmWindow;
20
21 // AcceleratorRouter does a minimal amount of processing before routing the 23 // AcceleratorRouter does a minimal amount of processing before routing the
22 // accelerator to the AcceleratorController. AcceleratorRouter may also decide 24 // accelerator to the AcceleratorController. AcceleratorRouter may also decide
23 // not to process certain accelerators. 25 // not to process certain accelerators.
24 class ASH_EXPORT AcceleratorRouter { 26 class ASH_EXPORT AcceleratorRouter {
25 public: 27 public:
26 AcceleratorRouter(); 28 AcceleratorRouter();
27 ~AcceleratorRouter(); 29 ~AcceleratorRouter();
28 30
29 // Returns true if event should be consumed. |target| is the target of the 31 // Returns true if event should be consumed. |target| is the target of the
30 // event. 32 // event.
31 bool ProcessAccelerator(WmWindow* target, 33 bool ProcessAccelerator(aura::Window* target,
32 const ui::KeyEvent& event, 34 const ui::KeyEvent& event,
33 const ui::Accelerator& accelerator); 35 const ui::Accelerator& accelerator);
34 36
35 private: 37 private:
36 // Returns true if the window should be allowed a chance to handle 38 // Returns true if the window should be allowed a chance to handle
37 // system keys. 39 // system keys.
38 bool CanConsumeSystemKeys(WmWindow* target, const ui::KeyEvent& event); 40 bool CanConsumeSystemKeys(aura::Window* target, const ui::KeyEvent& event);
39 41
40 // Returns true if the |accelerator| should be processed now. 42 // Returns true if the |accelerator| should be processed now.
41 bool ShouldProcessAcceleratorNow(WmWindow* target, 43 bool ShouldProcessAcceleratorNow(aura::Window* target,
42 const ui::KeyEvent& event, 44 const ui::KeyEvent& event,
43 const ui::Accelerator& accelerator); 45 const ui::Accelerator& accelerator);
44 46
45 // Records a histogram on how long the "Search" key is held when a user 47 // Records a histogram on how long the "Search" key is held when a user
46 // presses an accelerator that involes the "Search" key. 48 // presses an accelerator that involes the "Search" key.
47 void RecordSearchKeyStats(const ui::Accelerator& accelerator); 49 void RecordSearchKeyStats(const ui::Accelerator& accelerator);
48 50
49 enum SearchKeyState { RELEASED = 0, PRESSED, RECORDED }; 51 enum SearchKeyState { RELEASED = 0, PRESSED, RECORDED };
50 SearchKeyState search_key_state_ = RELEASED; 52 SearchKeyState search_key_state_ = RELEASED;
51 base::TimeTicks search_key_pressed_timestamp_; 53 base::TimeTicks search_key_pressed_timestamp_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(AcceleratorRouter); 55 DISALLOW_COPY_AND_ASSIGN(AcceleratorRouter);
54 }; 56 };
55 57
56 } // namespace ash 58 } // namespace ash
57 59
58 #endif // ASH_ACCELERATORS_ACCELERATOR_ROUTER_H_ 60 #endif // ASH_ACCELERATORS_ACCELERATOR_ROUTER_H_
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_delegate.cc ('k') | ash/accelerators/accelerator_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698