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

Side by Side Diff: ash/common/system/chromeos/palette/tools/laser_pointer_mode.h

Issue 2239743004: Palette tool laser prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch
Patch Set: Fixed patch set 4 errors. Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_
7
8 #include "ash/common/system/chromeos/palette/common_palette_tool.h"
9 #include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h"
jdufault 2016/08/19 01:02:08 Forward declare LaserPointerView
sammiequon 2016/08/19 20:28:46 Done.
10 #include "ui/views/pointer_watcher.h"
11
12 namespace ash {
13
14 // Controller for the laser pointer functionality. Enables/disables laser
15 // pointer as well as receives points and passes them off to be rendered.
16 class LaserPointerMode : public CommonPaletteTool,
17 public views::PointerWatcher {
18 public:
19 explicit LaserPointerMode(Delegate* delegate);
20 ~LaserPointerMode() override;
21
22 private:
23 friend class LaserPointerModeTestApi;
24
25 // PaletteTool:
26 PaletteGroup GetGroup() const override;
27 PaletteToolId GetToolId() const override;
28 void OnEnable() override;
29 void OnDisable() override;
30 gfx::VectorIconId GetActiveTrayIcon() override;
31 views::View* CreateView() override;
32
33 // CommonPaletteTool:
34 gfx::VectorIconId GetPaletteIconId() override;
35
36 // views::PointerWatcher:
37 void OnPointerEventObserved(const ui::PointerEvent& event,
38 const gfx::Point& location_in_screen,
39 views::Widget* target) override;
40
41 void StopTimer();
42
43 // Timer callback which adds a point where the mouse was last seen. This
44 // allows the trail to fade away when the mouse is stationary.
45 void AddStationaryPoint();
46
47 // Timer which will add a new stationary point when the mouse stops moving.
48 // This will remove points past a certain threshold.
49 std::unique_ptr<base::Timer> timer_;
50 int timer_repeat_count_ = 0;
51
52 gfx::Point current_mouse_location_;
53 std::unique_ptr<LaserPointerView> laser_pointer_view_;
54
55 DISALLOW_COPY_AND_ASSIGN(LaserPointerMode);
56 };
57
58 } // namespace ash
59
60 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698