OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_ | |
7 | |
8 #include <list> | |
9 #include <vector> | |
10 | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/scoped_vector.h" | |
13 #include "ui/aura/env_observer.h" | |
14 #include "ui/events/event_rewriter.h" | |
15 | |
16 namespace ui { | |
17 class EventSource; | |
18 } // namespace ui | |
19 | |
20 namespace chromeos { | |
21 | |
22 // Owns |ui::EventRewriter|s and ensures that they are added to all root | |
23 // windows |EventSource|s, current and future, in the order that they are | |
24 // added to this. | |
kpschoedel
2014/04/22 19:53:08
Changed to have one EventRewriterController handle
| |
25 class EventRewriterController : public aura::EnvObserver { | |
26 public: | |
27 explicit EventRewriterController(); | |
sadrul
2014/04/23 19:32:53
Don't need explicit
kpschoedel
2014/04/23 21:33:15
Done. (Previous version had 1 arg.)
| |
28 virtual ~EventRewriterController(); | |
29 | |
30 // Takes ownership of an EventRewriter; can only be called before Init(). | |
31 void AddEventRewriter(scoped_ptr<ui::EventRewriter> rewriter); | |
32 | |
33 // Add rewriters to any existing root windows; must be called once only | |
34 // after ash::Shell has been initialized. | |
sadrul
2014/04/23 19:32:53
I am curious to know why this is necessary. Is it
kpschoedel
2014/04/23 21:33:15
Partly, but more to ensure that all rewriters have
| |
35 void Init(); | |
36 | |
37 void Shutdown(); | |
sadrul
2014/04/23 19:32:53
Document (Destroys and removes all event-rewriters
kpschoedel
2014/04/23 21:33:15
Done.
| |
38 | |
39 // aura::EnvObserver overrides: | |
40 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE {} | |
41 virtual void OnHostInitialized(aura::WindowTreeHost* host) OVERRIDE; | |
42 | |
43 private: | |
44 typedef std::list<ui::EventSource*> EventSourceList; | |
45 typedef ScopedVector<ui::EventRewriter> EventRewriters; | |
46 | |
47 void AddToEventSource(ui::EventSource* source); | |
48 | |
49 // The |EventRewriter|s managed by this controller. | |
50 EventRewriters rewriters_; | |
51 | |
52 // Whether the owned event rewriters have been added to existing | |
53 // root windows; after this no more rewriters can be added. | |
54 bool initialized_; | |
55 | |
56 // Whether the owned event rewriters get added to new root windows. | |
57 bool operational_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(EventRewriterController); | |
60 }; | |
61 | |
62 } // namespace chromeos | |
63 | |
64 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_ | |
OLD | NEW |