1 // Copyright 2013 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_HUD_DEBUG_H_
6 #define ASH_TOUCH_TOUCH_HUD_DEBUG_H_
10 #include "ash/ash_export.h"
11 #include "ash/touch/touch_observer_hud.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h"
26 // A heads-up display to show touch traces on the screen and log touch events.
27 // As a derivative of TouchObserverHUD, objects of this class manage their own
29 class ASH_EXPORT TouchHudDebug
: public TouchObserverHUD
{
37 explicit TouchHudDebug(aura::RootWindow
* initial_root
);
39 // Returns the log of touch events for all displays as a dictionary mapping id
40 // of each display to its touch log.
41 static scoped_ptr
<DictionaryValue
> GetAllAsDictionary();
43 // Changes the display mode (e.g. scale, visibility). Calling this repeatedly
44 // cycles between a fixed number of display modes.
45 void ChangeToNextMode();
47 // Returns log of touch events as a list value. Each item in the list is a
48 // trace of one touch point.
49 scoped_ptr
<ListValue
> GetLogAsList() const;
51 Mode
mode() const { return mode_
; }
53 // Overriden from TouchObserverHUD.
54 virtual void Clear() OVERRIDE
;
57 virtual ~TouchHudDebug();
59 void SetMode(Mode mode
);
61 void UpdateTouchPointLabel(int index
);
63 // Overriden from TouchObserverHUD.
64 virtual void OnTouchEvent(ui::TouchEvent
* event
) OVERRIDE
;
65 virtual void OnDisplayBoundsChanged(const gfx::Display
& display
) OVERRIDE
;
66 virtual void SetHudForRootWindowController(
67 RootWindowController
* controller
) OVERRIDE
;
68 virtual void UnsetHudForRootWindowController(
69 RootWindowController
* controller
) OVERRIDE
;
71 static const int kMaxTouchPoints
= 32;
75 scoped_ptr
<TouchLog
> touch_log_
;
77 TouchHudCanvas
* canvas_
;
78 views::View
* label_container_
;
79 views::Label
* touch_labels_
[kMaxTouchPoints
];
81 DISALLOW_COPY_AND_ASSIGN(TouchHudDebug
);
84 } // namespace internal
87 #endif // ASH_TOUCH_TOUCH_HUD_DEBUG_H_