blob: 4e74e760727fd25e2b8651e22d68c4a14ff55a8f [file] [log] [blame]
// Copyright (c) 2012 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.
#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/display_observer.h"
#include "ui/views/widget/widget_observer.h"
#if defined(OS_CHROMEOS)
#include "chromeos/display/output_configurator.h"
#endif // defined(OS_CHROMEOS)
namespace views {
class Widget;
namespace ash {
namespace internal {
// An event filter which handles system level gesture events. Objects of this
// class manage their own lifetime.
class ASH_EXPORT TouchObserverHUD
: public ui::EventHandler,
public views::WidgetObserver,
public gfx::DisplayObserver,
#if defined(OS_CHROMEOS)
public chromeos::OutputConfigurator::Observer,
#endif // defined(OS_CHROMEOS)
public DisplayController::Observer {
// Called to clear touch points and traces from the screen. Default
// implementation does nothing. Sub-classes should implement appropriately.
virtual void Clear();
// Removes the HUD from the screen.
void Remove();
int64 display_id() const { return display_id_; }
explicit TouchObserverHUD(aura::Window* initial_root);
virtual ~TouchObserverHUD();
virtual void SetHudForRootWindowController(
RootWindowController* controller) = 0;
virtual void UnsetHudForRootWindowController(
RootWindowController* controller) = 0;
views::Widget* widget() { return widget_; }
// Overriden from ui::EventHandler.
virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Overridden from views::WidgetObserver.
virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// Overridden from gfx::DisplayObserver.
virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
#if defined(OS_CHROMEOS)
// Overriden from chromeos::OutputConfigurator::Observer.
virtual void OnDisplayModeChanged(
const std::vector<chromeos::OutputConfigurator::OutputSnapshot>& outputs)
#endif // defined(OS_CHROMEOS)
// Overriden form DisplayController::Observer.
virtual void OnDisplayConfigurationChanging() OVERRIDE;
virtual void OnDisplayConfigurationChanged() OVERRIDE;
friend class TouchHudTestBase;
const int64 display_id_;
aura::Window* root_window_;
views::Widget* widget_;
} // namespace internal
} // namespace ash