Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ash/touch/touch_observer_hud.h

Issue 17063013: Separate projection mode from rest of touch HUD (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/touch/touch_hud_projection.cc ('k') | ash/touch/touch_observer_hud.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ 5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_HUD_H_
6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ 6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_
7 7
8 #include <map>
9
10 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
11 #include "ash/display/display_controller.h" 9 #include "ash/display/display_controller.h"
12 #include "ash/shell.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h"
15 #include "ui/base/events/event_handler.h" 10 #include "ui/base/events/event_handler.h"
16 #include "ui/gfx/display_observer.h" 11 #include "ui/gfx/display_observer.h"
17 #include "ui/gfx/point.h"
18 #include "ui/views/widget/widget_observer.h" 12 #include "ui/views/widget/widget_observer.h"
19 13
20 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
21 #include "chromeos/display/output_configurator.h" 15 #include "chromeos/display/output_configurator.h"
22 #endif // defined(OS_CHROMEOS) 16 #endif // defined(OS_CHROMEOS)
23 17
24 namespace aura {
25 class Window;
26 }
27
28 namespace gfx {
29 class Display;
30 }
31
32 namespace views { 18 namespace views {
33 class Label;
34 class View;
35 class Widget; 19 class Widget;
36 } 20 }
37 21
38 namespace ash { 22 namespace ash {
39 namespace internal { 23 namespace internal {
40 24
41 class TouchHudCanvas;
42 class TouchLog;
43 class TouchPointView;
44
45 // An event filter which handles system level gesture events. Objects of this 25 // An event filter which handles system level gesture events. Objects of this
46 // class manage their own lifetime. 26 // class manage their own lifetime.
47 class ASH_EXPORT TouchObserverHUD 27 class ASH_EXPORT TouchObserverHUD
48 : public ui::EventHandler, 28 : public ui::EventHandler,
49 public views::WidgetObserver, 29 public views::WidgetObserver,
50 public gfx::DisplayObserver, 30 public gfx::DisplayObserver,
51 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
52 public chromeos::OutputConfigurator::Observer, 32 public chromeos::OutputConfigurator::Observer,
53 #endif // defined(OS_CHROMEOS) 33 #endif // defined(OS_CHROMEOS)
54 public DisplayController::Observer { 34 public DisplayController::Observer {
55 public: 35 public:
56 enum Mode { 36 // Called to clear touch points and traces from the screen. Default
57 FULLSCREEN, 37 // implementation does nothing. Sub-classes should implement appropriately.
58 REDUCED_SCALE, 38 virtual void Clear();
59 PROJECTION,
60 INVISIBLE,
61 };
62 39
40 // Removes the HUD from the screen.
41 void Remove();
42
43 int64 display_id() const { return display_id_; }
44
45 protected:
63 explicit TouchObserverHUD(aura::RootWindow* initial_root); 46 explicit TouchObserverHUD(aura::RootWindow* initial_root);
64 47
65 // Returns the log of touch events as a dictionary mapping id of each display
66 // to its touch log.
67 static scoped_ptr<DictionaryValue> GetAllAsDictionary();
68
69 // Changes the display mode (e.g. scale, visibility). Calling this repeatedly
70 // cycles between a fixed number of display modes.
71 void ChangeToNextMode();
72
73 // Removes all existing touch points from the screen (only if the HUD is
74 // visible).
75 void Clear();
76
77 // Returns log of touch events as a list value. Each item in the list is a
78 // trace of one touch point.
79 scoped_ptr<ListValue> GetLogAsList() const;
80
81 Mode mode() const { return mode_; }
82
83 private:
84 friend class TouchHudTest;
85
86 virtual ~TouchObserverHUD(); 48 virtual ~TouchObserverHUD();
87 49
88 void SetMode(Mode mode); 50 virtual void SetHudForRootWindowController(
51 RootWindowController* controller) = 0;
52 virtual void UnsetHudForRootWindowController(
53 RootWindowController* controller) = 0;
89 54
90 void UpdateTouchPointLabel(int index); 55 views::Widget* widget() { return widget_; }
91 56
92 // Overriden from ui::EventHandler: 57 // Overriden from ui::EventHandler.
93 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 58 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
94 59
95 // Overridden from views::WidgetObserver: 60 // Overridden from views::WidgetObserver.
96 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; 61 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
97 62
98 // Overridden from gfx::DisplayObserver: 63 // Overridden from gfx::DisplayObserver.
99 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE; 64 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
100 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; 65 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
101 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; 66 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
102 67
103 #if defined(OS_CHROMEOS) 68 #if defined(OS_CHROMEOS)
104 // Overriden from chromeos::OutputConfigurator::Observer: 69 // Overriden from chromeos::OutputConfigurator::Observer.
105 virtual void OnDisplayModeChanged() OVERRIDE; 70 virtual void OnDisplayModeChanged() OVERRIDE;
106 #endif // defined(OS_CHROMEOS) 71 #endif // defined(OS_CHROMEOS)
107 72
108 // Overriden form DisplayController::Observer: 73 // Overriden form DisplayController::Observer.
109 virtual void OnDisplayConfigurationChanging() OVERRIDE; 74 virtual void OnDisplayConfigurationChanging() OVERRIDE;
110 virtual void OnDisplayConfigurationChanged() OVERRIDE; 75 virtual void OnDisplayConfigurationChanged() OVERRIDE;
111 76
112 static const int kMaxTouchPoints = 32; 77 private:
78 friend class TouchHudTest;
113 79
114 const int64 display_id_; 80 const int64 display_id_;
115 aura::RootWindow* root_window_; 81 aura::RootWindow* root_window_;
116 82
117 Mode mode_;
118
119 scoped_ptr<TouchLog> touch_log_;
120
121 views::Widget* widget_; 83 views::Widget* widget_;
122 TouchHudCanvas* canvas_;
123 std::map<int, TouchPointView*> points_;
124 views::View* label_container_;
125 views::Label* touch_labels_[kMaxTouchPoints];
126 84
127 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD); 85 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD);
128 }; 86 };
129 87
130 } // namespace internal 88 } // namespace internal
131 } // namespace ash 89 } // namespace ash
132 90
133 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ 91 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_
OLDNEW
« no previous file with comments | « ash/touch/touch_hud_projection.cc ('k') | ash/touch/touch_observer_hud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698