Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / chromeos / events / event_rewriter_controller.h
blobf86a14ae6996203c5ea96ee83ead9b5be63dd979
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_
8 #include <list>
9 #include <vector>
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"
16 namespace ui {
17 class EventSource;
18 } // namespace ui
20 namespace chromeos {
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 ~EventRewriterController() override;
30 // Takes ownership of an EventRewriter; can only be called before Init().
31 void AddEventRewriter(scoped_ptr<ui::EventRewriter> rewriter);
33 // Add rewriters to any existing root windows; must be called once only
34 // after ash::Shell has been initialized.
35 void Init();
37 // aura::EnvObserver overrides:
38 void OnWindowInitialized(aura::Window* window) override {}
39 void OnHostInitialized(aura::WindowTreeHost* host) override;
41 private:
42 typedef std::list<ui::EventSource*> EventSourceList;
43 typedef ScopedVector<ui::EventRewriter> EventRewriters;
45 void AddToEventSource(ui::EventSource* source);
47 // The |EventRewriter|s managed by this controller.
48 EventRewriters rewriters_;
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_;
54 DISALLOW_COPY_AND_ASSIGN(EventRewriterController);
57 } // namespace chromeos
59 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_EVENT_REWRITER_CONTROLLER_H_