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

Side by Side Diff: components/view_manager/event_dispatcher.h

Issue 1149083010: Mandoline: Remove native_viewport.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Windows Build I hope Created 5 years, 6 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 | « components/view_manager/display_manager.cc ('k') | components/view_manager/event_dispatcher.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 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 COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_ 5 #ifndef COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_
6 #define COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_ 6 #define COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "components/view_manager/public/interfaces/native_viewport.mojom.h" 11 #include "ui/mojo/events/input_event_constants.mojom.h"
12 #include "ui/mojo/events/input_events.mojom.h"
13 #include "ui/mojo/events/input_key_codes.mojom.h"
12 14
13 namespace view_manager { 15 namespace view_manager {
14 16
15 class ConnectionManager; 17 class ConnectionManager;
16 18
17 // Handles dispatching events to the right location as well as updating focus. 19 // Handles dispatching events to the right location as well as updating focus.
18 class EventDispatcher : public mojo::NativeViewportEventDispatcher { 20 class EventDispatcher {
19 public: 21 public:
20 explicit EventDispatcher(ConnectionManager* connection_manager); 22 explicit EventDispatcher(ConnectionManager* connection_manager);
21 ~EventDispatcher() override; 23 ~EventDispatcher();
22 24
23 void AddAccelerator(mojo::KeyboardCode keyboard_code, mojo::EventFlags flags); 25 void AddAccelerator(mojo::KeyboardCode keyboard_code, mojo::EventFlags flags);
24 void RemoveAccelerator(mojo::KeyboardCode keyboard_code, 26 void RemoveAccelerator(mojo::KeyboardCode keyboard_code,
25 mojo::EventFlags flags); 27 mojo::EventFlags flags);
26 28
27 // NativeViewportEventDispatcher: 29 void OnEvent(mojo::EventPtr event);
28 void OnEvent(mojo::EventPtr event, const OnEventCallback& callback) override;
29 30
30 private: 31 private:
31 struct Accelerator { 32 struct Accelerator {
32 Accelerator(mojo::KeyboardCode keyboard_code, mojo::EventFlags flags) 33 Accelerator(mojo::KeyboardCode keyboard_code, mojo::EventFlags flags)
33 : keyboard_code(keyboard_code), flags(flags) {} 34 : keyboard_code(keyboard_code), flags(flags) {}
34 35
35 // So we can use this in a set. 36 // So we can use this in a set.
36 bool operator<(const Accelerator& other) const { 37 bool operator<(const Accelerator& other) const {
37 if (keyboard_code == other.keyboard_code) 38 if (keyboard_code == other.keyboard_code)
38 return flags < other.flags; 39 return flags < other.flags;
39 return keyboard_code < other.keyboard_code; 40 return keyboard_code < other.keyboard_code;
40 } 41 }
41 42
42 mojo::KeyboardCode keyboard_code; 43 mojo::KeyboardCode keyboard_code;
43 mojo::EventFlags flags; 44 mojo::EventFlags flags;
44 }; 45 };
45 46
46 ConnectionManager* connection_manager_; 47 ConnectionManager* connection_manager_;
47 48
48 std::set<Accelerator> accelerators_; 49 std::set<Accelerator> accelerators_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 51 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
51 }; 52 };
52 53
53 } // namespace view_manager 54 } // namespace view_manager
54 55
55 #endif // COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_ 56 #endif // COMPONENTS_VIEW_MANAGER_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « components/view_manager/display_manager.cc ('k') | components/view_manager/event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698