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

Side by Side Diff: chrome/browser/chromeos/events/event_rewriter_controller.h

Issue 240173007: Convert KeyboardDrivenEventRewriter to a ui::EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments on Patch Set 4 Created 6 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
OLDNEW
(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.
25 class EventRewriterController : public aura::EnvObserver {
26 public:
27 EventRewriterController();
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.
35 void Init();
36
37 // aura::EnvObserver overrides:
38 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE {}
39 virtual void OnHostInitialized(aura::WindowTreeHost* host) OVERRIDE;
40
41 private:
42 typedef std::list<ui::EventSource*> EventSourceList;
43 typedef ScopedVector<ui::EventRewriter> EventRewriters;
44
45 void AddToEventSource(ui::EventSource* source);
46
47 // The |EventRewriter|s managed by this controller.
48 EventRewriters rewriters_;
49
50 // Whether the owned event rewriters have been added to existing
51 // root windows; after this no more rewriters can be added.
52 bool initialized_;
53
54 DISALLOW_COPY_AND_ASSIGN(EventRewriterController);
55 };
56
57 } // namespace chromeos
58
59 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/events/event_rewriter.cc ('k') | chrome/browser/chromeos/events/event_rewriter_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698