Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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. | |
| 4 | |
| 5 #ifndef ASH_TOUCH_TOUCH_HUD_DEBUGGING_H_ | |
|
sadrul
2013/06/26 17:26:21
I would call this TouchHudDebug
mohsen
2013/06/26 19:15:49
Done.
| |
| 6 #define ASH_TOUCH_TOUCH_HUD_DEBUGGING_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 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" | |
| 14 | |
| 15 namespace views { | |
| 16 class Label; | |
| 17 class View; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 namespace internal { | |
| 22 | |
| 23 class TouchHudCanvas; | |
| 24 class TouchLog; | |
| 25 | |
| 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 | |
| 28 // lifetime. | |
| 29 class ASH_EXPORT TouchHudDebugging : public TouchObserverHUD { | |
| 30 public: | |
| 31 enum Mode { | |
| 32 FULLSCREEN, | |
| 33 REDUCED_SCALE, | |
| 34 INVISIBLE, | |
| 35 }; | |
| 36 | |
| 37 explicit TouchHudDebugging(aura::RootWindow* initial_root); | |
| 38 | |
| 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(); | |
| 42 | |
| 43 // Changes the display mode (e.g. scale, visibility). Calling this repeatedly | |
| 44 // cycles between a fixed number of display modes. | |
| 45 void ChangeToNextMode(); | |
| 46 | |
| 47 // Removes all existing touch traces from the screen (only if the HUD is | |
| 48 // visible). | |
| 49 virtual void Clear() OVERRIDE; | |
|
sadrul
2013/06/26 17:26:21
Replace the comment with: // Overridden from ...,
mohsen
2013/06/26 19:15:49
Done.
| |
| 50 | |
| 51 // Returns log of touch events as a list value. Each item in the list is a | |
| 52 // trace of one touch point. | |
| 53 scoped_ptr<ListValue> GetLogAsList() const; | |
| 54 | |
| 55 Mode mode() const { return mode_; } | |
| 56 | |
| 57 private: | |
| 58 virtual ~TouchHudDebugging(); | |
| 59 | |
| 60 void SetMode(Mode mode); | |
| 61 | |
| 62 void UpdateTouchPointLabel(int index); | |
| 63 | |
| 64 // Overriden from TouchObserverHUD. | |
| 65 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | |
| 66 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; | |
| 67 virtual void SetHudForRootWindowController( | |
| 68 RootWindowController* controller) OVERRIDE; | |
| 69 virtual void UnsetHudForRootWindowController( | |
| 70 RootWindowController* controller) OVERRIDE; | |
| 71 | |
| 72 static const int kMaxTouchPoints = 32; | |
| 73 | |
| 74 Mode mode_; | |
| 75 | |
| 76 scoped_ptr<TouchLog> touch_log_; | |
| 77 | |
| 78 TouchHudCanvas* canvas_; | |
| 79 views::View* label_container_; | |
| 80 views::Label* touch_labels_[kMaxTouchPoints]; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(TouchHudDebugging); | |
| 83 }; | |
| 84 | |
| 85 } // namespace internal | |
| 86 } // namespace ash | |
| 87 | |
| 88 #endif // ASH_TOUCH_TOUCH_HUD_DEBUGGING_H_ | |
| OLD | NEW |