Implement listing tests to a JSON file for iOS gtest test launcher
[chromium-blink-merge.git] / ash / touch / touch_observer_hud.h
blobe168e9f814c99ccc8fdbcab5be2a32cc29bc8978
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 ~TouchObserverHUD() override;
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 void OnTouchEvent(ui::TouchEvent* event) override;
58 // Overridden from views::WidgetObserver.
59 void OnWidgetDestroying(views::Widget* widget) override;
61 // Overridden from gfx::DisplayObserver.
62 void OnDisplayAdded(const gfx::Display& new_display) override;
63 void OnDisplayRemoved(const gfx::Display& old_display) override;
64 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 void OnDisplaysInitialized() override;
75 void OnDisplayConfigurationChanging() override;
76 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_