| OLD | NEW |
| 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 COMPONENTS_MUS_WS_ACCELERATOR_H_ | 5 #ifndef COMPONENTS_MUS_WS_ACCELERATOR_H_ |
| 6 #define COMPONENTS_MUS_WS_ACCELERATOR_H_ | 6 #define COMPONENTS_MUS_WS_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // an event having been matched and the dispatch of the accelerator to the | 26 // an event having been matched and the dispatch of the accelerator to the |
| 27 // client. | 27 // client. |
| 28 class Accelerator { | 28 class Accelerator { |
| 29 public: | 29 public: |
| 30 Accelerator(uint32_t id, const mojom::EventMatcher& matcher); | 30 Accelerator(uint32_t id, const mojom::EventMatcher& matcher); |
| 31 ~Accelerator(); | 31 ~Accelerator(); |
| 32 | 32 |
| 33 // Returns true if |event| and |phase | matches the definition in the | 33 // Returns true if |event| and |phase | matches the definition in the |
| 34 // mojom::EventMatcher used for initialization. | 34 // mojom::EventMatcher used for initialization. |
| 35 bool MatchesEvent(const ui::Event& event, | 35 bool MatchesEvent(const ui::Event& event, |
| 36 const mojom::AcceleratorPhase phase) const; | 36 const ui::mojom::AcceleratorPhase phase) const; |
| 37 | 37 |
| 38 // Returns true if |other| was created with an identical mojom::EventMatcher. | 38 // Returns true if |other| was created with an identical mojom::EventMatcher. |
| 39 bool EqualEventMatcher(const Accelerator* other) const; | 39 bool EqualEventMatcher(const Accelerator* other) const; |
| 40 | 40 |
| 41 base::WeakPtr<Accelerator> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } | 41 base::WeakPtr<Accelerator> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 42 | 42 |
| 43 uint32_t id() const { return id_; } | 43 uint32_t id() const { return id_; } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 uint32_t id_; | 46 uint32_t id_; |
| 47 mojom::AcceleratorPhase accelerator_phase_; | 47 ui::mojom::AcceleratorPhase accelerator_phase_; |
| 48 EventMatcher event_matcher_; | 48 EventMatcher event_matcher_; |
| 49 base::WeakPtrFactory<Accelerator> weak_factory_; | 49 base::WeakPtrFactory<Accelerator> weak_factory_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(Accelerator); | 51 DISALLOW_COPY_AND_ASSIGN(Accelerator); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace ws | 54 } // namespace ws |
| 55 } // namespace mus | 55 } // namespace mus |
| 56 | 56 |
| 57 #endif // COMPONENTS_MUS_WS_ACCELERATOR_H_ | 57 #endif // COMPONENTS_MUS_WS_ACCELERATOR_H_ |
| OLD | NEW |