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" |
| 11 #include "ash/resources/vector_icons/vector_icons.h" |
11 #include "grit/ash_strings.h" | 12 #include "grit/ash_strings.h" |
12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
13 #include "ui/wm/core/coordinate_conversion.h" | 14 #include "ui/wm/core/coordinate_conversion.h" |
14 #include "ui/wm/core/cursor_manager.h" | 15 #include "ui/wm/core/cursor_manager.h" |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
17 namespace { | 18 namespace { |
18 | 19 |
19 // A point gets removed from the collection if it is older than | 20 // A point gets removed from the collection if it is older than |
20 // |kPointLifeDurationMs|. | 21 // |kPointLifeDurationMs|. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 61 } |
61 | 62 |
62 void LaserPointerMode::OnDisable() { | 63 void LaserPointerMode::OnDisable() { |
63 CommonPaletteTool::OnDisable(); | 64 CommonPaletteTool::OnDisable(); |
64 | 65 |
65 WmShell::Get()->palette_delegate()->OnLaserPointerDisabled(); | 66 WmShell::Get()->palette_delegate()->OnLaserPointerDisabled(); |
66 StopTimer(); | 67 StopTimer(); |
67 laser_pointer_view_->Stop(); | 68 laser_pointer_view_->Stop(); |
68 } | 69 } |
69 | 70 |
70 gfx::VectorIconId LaserPointerMode::GetActiveTrayIcon() { | 71 const gfx::VectorIcon& LaserPointerMode::GetActiveTrayIcon() const { |
71 return gfx::VectorIconId::PALETTE_TRAY_ICON_LASER_POINTER; | 72 return kPaletteTrayIconLaserPointerIcon; |
72 } | 73 } |
73 | 74 |
74 gfx::VectorIconId LaserPointerMode::GetPaletteIconId() { | 75 const gfx::VectorIcon& LaserPointerMode::GetPaletteIcon() const { |
75 return gfx::VectorIconId::PALETTE_MODE_LASER_POINTER; | 76 return kPaletteModeLaserPointerIcon; |
76 } | 77 } |
77 | 78 |
78 views::View* LaserPointerMode::CreateView() { | 79 views::View* LaserPointerMode::CreateView() { |
79 return CreateDefaultView( | 80 return CreateDefaultView( |
80 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_LASER_POINTER_MODE)); | 81 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_LASER_POINTER_MODE)); |
81 } | 82 } |
82 | 83 |
83 void LaserPointerMode::StopTimer() { | 84 void LaserPointerMode::StopTimer() { |
84 timer_repeat_count_ = 0; | 85 timer_repeat_count_ = 0; |
85 timer_->Stop(); | 86 timer_->Stop(); |
(...skipping 20 matching lines...) Expand all Loading... |
106 current_mouse_location_ = location_in_screen; | 107 current_mouse_location_ = location_in_screen; |
107 if (enabled()) { | 108 if (enabled()) { |
108 laser_pointer_view_->AddNewPoint(current_mouse_location_); | 109 laser_pointer_view_->AddNewPoint(current_mouse_location_); |
109 timer_repeat_count_ = 0; | 110 timer_repeat_count_ = 0; |
110 if (!timer_->IsRunning()) | 111 if (!timer_->IsRunning()) |
111 timer_->Reset(); | 112 timer_->Reset(); |
112 } | 113 } |
113 } | 114 } |
114 } | 115 } |
115 } // namespace ash | 116 } // namespace ash |
OLD | NEW |