| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "athena/input/public/input_manager.h" | 5 #include "athena/input/public/input_manager.h" |
| 6 | 6 |
| 7 #include "athena/input/accelerator_manager_impl.h" | 7 #include "athena/input/accelerator_manager_impl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/aura/client/event_client.h" | 9 #include "ui/aura/client/event_client.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| 11 #include "ui/aura/window.h" |
| 11 #include "ui/events/event_target.h" | 12 #include "ui/events/event_target.h" |
| 12 | 13 |
| 13 namespace athena { | 14 namespace athena { |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 InputManager* instance = NULL; | 17 InputManager* instance = NULL; |
| 17 | 18 |
| 18 class InputManagerImpl : public InputManager, | 19 class InputManagerImpl : public InputManager, |
| 19 public ui::EventTarget, | 20 public ui::EventTarget, |
| 20 public aura::client::EventClient { | 21 public aura::client::EventClient { |
| 21 public: | 22 public: |
| 22 InputManagerImpl(); | 23 InputManagerImpl(); |
| 23 virtual ~InputManagerImpl(); | 24 virtual ~InputManagerImpl(); |
| 24 | 25 |
| 25 void Init(); | 26 void Init(); |
| 26 void Shutdown(); | 27 void Shutdown(); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 // InputManager: | 30 // InputManager: |
| 30 virtual void OnRootWindowCreated(aura::Window* root_window) OVERRIDE; | 31 virtual void OnRootWindowCreated(aura::Window* root_window) OVERRIDE; |
| 31 virtual ui::EventTarget* GetTopmostEventTarget() OVERRIDE { return this; } | 32 virtual ui::EventTarget* GetTopmostEventTarget() OVERRIDE { return this; } |
| 32 virtual AcceleratorManager* GetAcceleratorManager() OVERRIDE { | 33 virtual AcceleratorManager* GetAcceleratorManager() OVERRIDE { |
| 33 return accelerator_manager_.get(); | 34 return accelerator_manager_.get(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Overridden from aura::client::EventClient: | 37 // Overridden from aura::client::EventClient: |
| 37 virtual bool CanProcessEventsWithinSubtree( | 38 virtual bool CanProcessEventsWithinSubtree( |
| 38 const aura::Window* window) const OVERRIDE { | 39 const aura::Window* window) const OVERRIDE { |
| 39 return true; | 40 return window && !window->ignore_events(); |
| 40 } | 41 } |
| 41 virtual ui::EventTarget* GetToplevelEventTarget() OVERRIDE { return this; } | 42 virtual ui::EventTarget* GetToplevelEventTarget() OVERRIDE { return this; } |
| 42 | 43 |
| 43 // ui::EventTarget: | 44 // ui::EventTarget: |
| 44 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 45 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; |
| 45 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 46 virtual ui::EventTarget* GetParentTarget() OVERRIDE; |
| 46 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 47 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; |
| 47 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 48 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; |
| 48 virtual void OnEvent(ui::Event* event) OVERRIDE; | 49 virtual void OnEvent(ui::Event* event) OVERRIDE; |
| 49 | 50 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 114 } |
| 114 | 115 |
| 115 // static | 116 // static |
| 116 void InputManager::Shutdown() { | 117 void InputManager::Shutdown() { |
| 117 DCHECK(instance); | 118 DCHECK(instance); |
| 118 delete instance; | 119 delete instance; |
| 119 DCHECK(!instance); | 120 DCHECK(!instance); |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace athena | 123 } // namespace athena |
| OLD | NEW |