| 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/input_manager_impl.h" | 5 #include "athena/input/input_manager_impl.h" |
| 6 | 6 |
| 7 #include "athena/input/power_button_controller.h" | 7 #include "athena/input/power_button_controller.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 | 11 |
| 12 namespace athena { | 12 namespace athena { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 InputManager* instance = NULL; | 15 InputManager* instance = nullptr; |
| 16 | 16 |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 InputManagerImpl::InputManagerImpl() | 19 InputManagerImpl::InputManagerImpl() |
| 20 : accelerator_manager_( | 20 : accelerator_manager_( |
| 21 AcceleratorManagerImpl::CreateGlobalAcceleratorManager()), | 21 AcceleratorManagerImpl::CreateGlobalAcceleratorManager()), |
| 22 power_button_controller_(new PowerButtonController) { | 22 power_button_controller_(new PowerButtonController) { |
| 23 DCHECK(!instance); | 23 DCHECK(!instance); |
| 24 instance = this; | 24 instance = this; |
| 25 } | 25 } |
| 26 | 26 |
| 27 InputManagerImpl::~InputManagerImpl() { | 27 InputManagerImpl::~InputManagerImpl() { |
| 28 DCHECK_EQ(instance, this); | 28 DCHECK_EQ(instance, this); |
| 29 Shutdown(); | 29 Shutdown(); |
| 30 instance = NULL; | 30 instance = nullptr; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void InputManagerImpl::Init() { | 33 void InputManagerImpl::Init() { |
| 34 accelerator_manager_->Init(); | 34 accelerator_manager_->Init(); |
| 35 power_button_controller_->InstallAccelerators(); | 35 power_button_controller_->InstallAccelerators(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void InputManagerImpl::Shutdown() { | 38 void InputManagerImpl::Shutdown() { |
| 39 accelerator_manager_.reset(); | 39 accelerator_manager_.reset(); |
| 40 } | 40 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ui::EventTarget* InputManagerImpl::GetParentTarget() { | 76 ui::EventTarget* InputManagerImpl::GetParentTarget() { |
| 77 return aura::Env::GetInstance(); | 77 return aura::Env::GetInstance(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 scoped_ptr<ui::EventTargetIterator> InputManagerImpl::GetChildIterator() const { | 80 scoped_ptr<ui::EventTargetIterator> InputManagerImpl::GetChildIterator() const { |
| 81 return scoped_ptr<ui::EventTargetIterator>(); | 81 return scoped_ptr<ui::EventTargetIterator>(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 ui::EventTargeter* InputManagerImpl::GetEventTargeter() { | 84 ui::EventTargeter* InputManagerImpl::GetEventTargeter() { |
| 85 NOTREACHED(); | 85 NOTREACHED(); |
| 86 return NULL; | 86 return nullptr; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void InputManagerImpl::OnEvent(ui::Event* event) { | 89 void InputManagerImpl::OnEvent(ui::Event* event) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 int InputManagerImpl::SetPowerButtonTimeoutMsForTest(int timeout) { | 92 int InputManagerImpl::SetPowerButtonTimeoutMsForTest(int timeout) { |
| 93 return power_button_controller_->SetPowerButtonTimeoutMsForTest(timeout); | 93 return power_button_controller_->SetPowerButtonTimeoutMsForTest(timeout); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // static | 96 // static |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 // static | 109 // static |
| 110 void InputManager::Shutdown() { | 110 void InputManager::Shutdown() { |
| 111 DCHECK(instance); | 111 DCHECK(instance); |
| 112 delete instance; | 112 delete instance; |
| 113 DCHECK(!instance); | 113 DCHECK(!instance); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace athena | 116 } // namespace athena |
| OLD | NEW |