| Index: athena/input/input_manager_impl.h
|
| diff --git a/athena/input/input_manager_impl.h b/athena/input/input_manager_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ab3c7e7b587c11a0981faa039ab8e87e2fc149e4
|
| --- /dev/null
|
| +++ b/athena/input/input_manager_impl.h
|
| @@ -0,0 +1,91 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef ATHENA_INPUT_INPUT_MANAGER_IMPL_H_
|
| +#define ATHENA_INPUT_INPUT_MANAGER_IMPL_H_
|
| +
|
| +#include "athena/input/public/input_manager.h"
|
| +
|
| +#include "athena/athena_export.h"
|
| +#include "athena/input/accelerator_manager_impl.h"
|
| +#include "base/observer_list.h"
|
| +#include "base/timer/timer.h"
|
| +#include "chromeos/dbus/power_manager_client.h"
|
| +#include "ui/aura/client/event_client.h"
|
| +#include "ui/events/event_target.h"
|
| +
|
| +namespace athena {
|
| +namespace test {
|
| +class ScopedPowerButtonTimeoutShortener;
|
| +}
|
| +
|
| +class ATHENA_EXPORT InputManagerImpl
|
| + : public InputManager,
|
| + public ui::EventTarget,
|
| + public aura::client::EventClient,
|
| + public chromeos::PowerManagerClient::Observer,
|
| + public AcceleratorHandler {
|
| + public:
|
| + InputManagerImpl();
|
| + virtual ~InputManagerImpl();
|
| +
|
| + void Init();
|
| + void Shutdown();
|
| +
|
| + private:
|
| + friend class test::ScopedPowerButtonTimeoutShortener;
|
| +
|
| + // InputManager:
|
| + virtual void OnRootWindowCreated(aura::Window* root_window) override;
|
| + virtual ui::EventTarget* GetTopmostEventTarget() override;
|
| + virtual AcceleratorManager* GetAcceleratorManager() override;
|
| + virtual void AddPowerButtonObserver(PowerButtonObserver* observer) override;
|
| + virtual void RemovePowerButtonObserver(
|
| + PowerButtonObserver* observer) override;
|
| +
|
| + // Overridden from aura::client::EventClient:
|
| + virtual bool CanProcessEventsWithinSubtree(
|
| + const aura::Window* window) const override;
|
| + virtual ui::EventTarget* GetToplevelEventTarget() override;
|
| +
|
| + // ui::EventTarget:
|
| + virtual bool CanAcceptEvent(const ui::Event& event) override;
|
| + virtual ui::EventTarget* GetParentTarget() override;
|
| + virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override;
|
| + virtual ui::EventTargeter* GetEventTargeter() override;
|
| + virtual void OnEvent(ui::Event* event) override;
|
| +
|
| + // chromeos::PowerManagerClient::Observer:
|
| + virtual void BrightnessChanged(int level, bool user_initiated) override;
|
| + virtual void PowerButtonEventReceived(
|
| + bool down,
|
| + const base::TimeTicks& timestamp) override;
|
| +
|
| + // AcceleratorHandler:
|
| + virtual bool IsCommandEnabled(int command_id) const override;
|
| + virtual bool OnAcceleratorFired(int command_id,
|
| + const ui::Accelerator& accelerator) override;
|
| +
|
| + // A timer callabck to notify the long press event.
|
| + void NotifyLongPress();
|
| +
|
| + void InstallAccelerators();
|
| +
|
| + int SetPowerButtonTimeoutMsForTest(int timeout);
|
| +
|
| + scoped_ptr<AcceleratorManagerImpl> accelerator_manager_;
|
| +
|
| + int power_button_timeout_ms_;
|
| + ObserverList<PowerButtonObserver> power_button_observers_;
|
| + // The last time at which the screen brightness was 0%.
|
| + base::TimeTicks zero_brightness_end_time_;
|
| + bool brightness_is_zero_;
|
| + base::OneShotTimer<InputManagerImpl> timer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InputManagerImpl);
|
| +};
|
| +
|
| +} // namespace athena
|
| +
|
| +#endif // ATHENA_INPUT_INPUT_MANAGER_IMPL_H_
|
|
|