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

Unified 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: Addressed comments from issue 2231533004. 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/system/chromeos/palette/tools/laser_pointer_mode.h
diff --git a/ash/common/system/chromeos/palette/tools/laser_pointer_mode.h b/ash/common/system/chromeos/palette/tools/laser_pointer_mode.h
new file mode 100644
index 0000000000000000000000000000000000000000..6afda2f80ee37a3f412947dd65e88da653fdedc0
--- /dev/null
+++ b/ash/common/system/chromeos/palette/tools/laser_pointer_mode.h
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_
+#define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_
+
+#include "ash/common/system/chromeos/palette/common_palette_tool.h"
+#include "ash/common/system/chromeos/palette/tools/laser_pointer_points.h"
+#include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h"
+#include "ui/views/pointer_watcher.h"
+
+namespace ash {
+
+// Controller for the laser pointer functionality. Enables/disables laser
+// pointer as well as receives points and passes them off to be rendered.
jdufault 2016/08/12 19:57:58 This needs to use actual strings/labels. See https
sammiequon 2016/08/16 17:00:04 Done.
+class LaserPointerMode : public CommonPaletteTool,
+ public views::PointerWatcher {
+ public:
+ explicit LaserPointerMode(Delegate* delegate);
+ ~LaserPointerMode() override;
+
+ private:
+ // Timer which will add a new stationary point when the mouse stops moving.
+ // This will remove points past a certain threshold.
+ std::unique_ptr<base::Timer> timer_;
+ base::Lock points_lock_;
jdufault 2016/08/12 19:57:58 Move all data members to the end of the class decl
sammiequon 2016/08/16 17:00:04 Done.
+ int timer_repeat_count_ = 0;
+
+ gfx::Point current_mouse_location_;
+ LaserPointerPoints laser_points_;
+ std::unique_ptr<LaserPointerView> laser_pointer_view_;
+
+ // PaletteTool:
+ PaletteGroup GetGroup() const override;
+ PaletteToolId GetToolId() const override;
+ void OnEnable() override;
+ void OnDisable() override;
+ gfx::VectorIconId GetActiveTrayIcon() override;
+
+ // CommonPaletteTool overrides.
jdufault 2016/08/12 19:57:58 CommonPaletteTool:
sammiequon 2016/08/16 17:00:04 Done.
+ gfx::VectorIconId GetPaletteIconId() override;
+ // views::PointerWatcher:
jdufault 2016/08/12 19:57:58 Newline above
sammiequon 2016/08/16 17:00:04 Done.
+ void OnPointerEventObserved(const ui::PointerEvent& event,
+ const gfx::Point& location_in_screen,
+ views::Widget* target) override;
+
+ void InitializeTimer();
+ void StartTimer();
+ void StopTimer();
+ // Timer callback which adds a point where the mouse was last seen. This takes
jdufault 2016/08/12 19:57:58 Newline above comment.
jdufault 2016/08/12 19:57:58 What about for the second sentence, This allows
sammiequon 2016/08/16 17:00:04 Done.
sammiequon 2016/08/16 17:00:04 Done.
+ // care of fading away the tail of the laser when the mouse is stationary.
+ void AddStationaryPoint();
+
+ DISALLOW_COPY_AND_ASSIGN(LaserPointerMode);
+};
+
+} // namespace ash
+
+#endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_

Powered by Google App Engine
This is Rietveld 408576698