OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "ash/common/system/chromeos/palette/tools/laser_pointer_mode.h" | 5 #include "ash/common/system/chromeos/palette/tools/laser_pointer_mode.h" |
6 | 6 |
7 #include "ash/common/palette_delegate.h" | 7 #include "ash/common/palette_delegate.h" |
8 #include "ash/common/system/chromeos/palette/palette_ids.h" | 8 #include "ash/common/system/chromeos/palette/palette_ids.h" |
9 #include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h" | 9 #include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 LaserPointerMode::LaserPointerMode(Delegate* delegate) | 30 LaserPointerMode::LaserPointerMode(Delegate* delegate) |
31 : CommonPaletteTool(delegate) { | 31 : CommonPaletteTool(delegate) { |
32 laser_pointer_view_.reset(new LaserPointerView( | 32 laser_pointer_view_.reset(new LaserPointerView( |
33 base::TimeDelta::FromMilliseconds(kPointLifeDurationMs))); | 33 base::TimeDelta::FromMilliseconds(kPointLifeDurationMs))); |
34 timer_.reset(new base::Timer( | 34 timer_.reset(new base::Timer( |
35 FROM_HERE, base::TimeDelta::FromMilliseconds(kAddStationaryPointsDelayMs), | 35 FROM_HERE, base::TimeDelta::FromMilliseconds(kAddStationaryPointsDelayMs), |
36 base::Bind(&LaserPointerMode::AddStationaryPoint, base::Unretained(this)), | 36 base::Bind(&LaserPointerMode::AddStationaryPoint, base::Unretained(this)), |
37 true)); | 37 true)); |
38 WmShell::Get()->AddPointerWatcher(this, true); | 38 WmShell::Get()->AddPointerWatcher(this, |
| 39 views::PointerWatcherEventTypes::DRAGS); |
39 } | 40 } |
40 | 41 |
41 LaserPointerMode::~LaserPointerMode() { | 42 LaserPointerMode::~LaserPointerMode() { |
42 OnDisable(); | 43 OnDisable(); |
43 WmShell::Get()->RemovePointerWatcher(this); | 44 WmShell::Get()->RemovePointerWatcher(this); |
44 } | 45 } |
45 | 46 |
46 PaletteGroup LaserPointerMode::GetGroup() const { | 47 PaletteGroup LaserPointerMode::GetGroup() const { |
47 return PaletteGroup::MODE; | 48 return PaletteGroup::MODE; |
48 } | 49 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 current_mouse_location_ = location_in_screen; | 106 current_mouse_location_ = location_in_screen; |
106 if (enabled()) { | 107 if (enabled()) { |
107 laser_pointer_view_->AddNewPoint(current_mouse_location_); | 108 laser_pointer_view_->AddNewPoint(current_mouse_location_); |
108 timer_repeat_count_ = 0; | 109 timer_repeat_count_ = 0; |
109 if (!timer_->IsRunning()) | 110 if (!timer_->IsRunning()) |
110 timer_->Reset(); | 111 timer_->Reset(); |
111 } | 112 } |
112 } | 113 } |
113 } | 114 } |
114 } // namespace ash | 115 } // namespace ash |
OLD | NEW |