Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / touch / touch_observer_hud.h
blob816fb98b1cbc2533f4b781ecb8feb23ef4631a01
1 // Copyright (c) 2012 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 ASH_TOUCH_TOUCH_OBSERVER_HUD_H_
6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_
8 #include "ash/ash_export.h"
9 #include "ash/display/display_controller.h"
10 #include "ui/events/event_handler.h"
11 #include "ui/gfx/display_observer.h"
12 #include "ui/views/widget/widget_observer.h"
14 #if defined(OS_CHROMEOS)
15 #include "ui/display/chromeos/display_configurator.h"
16 #endif // defined(OS_CHROMEOS)
18 namespace views {
19 class Widget;
22 namespace ash {
24 // An event filter which handles system level gesture events. Objects of this
25 // class manage their own lifetime.
26 class ASH_EXPORT TouchObserverHUD : public ui::EventHandler,
27 public views::WidgetObserver,
28 public gfx::DisplayObserver,
29 #if defined(OS_CHROMEOS)
30 public ui::DisplayConfigurator::Observer,
31 #endif // defined(OS_CHROMEOS)
32 public DisplayController::Observer {
33 public:
34 // Called to clear touch points and traces from the screen. Default
35 // implementation does nothing. Sub-classes should implement appropriately.
36 virtual void Clear();
38 // Removes the HUD from the screen.
39 void Remove();
41 int64 display_id() const { return display_id_; }
43 protected:
44 explicit TouchObserverHUD(aura::Window* initial_root);
46 virtual ~TouchObserverHUD();
48 virtual void SetHudForRootWindowController(
49 RootWindowController* controller) = 0;
50 virtual void UnsetHudForRootWindowController(
51 RootWindowController* controller) = 0;
53 views::Widget* widget() { return widget_; }
55 // Overriden from ui::EventHandler.
56 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
58 // Overridden from views::WidgetObserver.
59 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
61 // Overridden from gfx::DisplayObserver.
62 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
63 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
64 virtual void OnDisplayMetricsChanged(const gfx::Display& display,
65 uint32_t metrics) OVERRIDE;
67 #if defined(OS_CHROMEOS)
68 // Overriden from ui::DisplayConfigurator::Observer.
69 virtual void OnDisplayModeChanged(
70 const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE;
71 #endif // defined(OS_CHROMEOS)
73 // Overriden form DisplayController::Observer.
74 virtual void OnDisplaysInitialized() OVERRIDE;
75 virtual void OnDisplayConfigurationChanging() OVERRIDE;
76 virtual void OnDisplayConfigurationChanged() OVERRIDE;
78 private:
79 friend class TouchHudTestBase;
81 const int64 display_id_;
82 aura::Window* root_window_;
84 views::Widget* widget_;
86 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD);
89 } // namespace ash
91 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_