OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autoclick/autoclick_controller.h" | 5 #include "ash/autoclick/autoclick_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/coordinate_conversion.h" | 8 #include "ash/wm/coordinate_conversion.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 } else if (event->type() == ui::ET_MOUSE_PRESSED) { | 147 } else if (event->type() == ui::ET_MOUSE_PRESSED) { |
148 autoclick_timer_->Stop(); | 148 autoclick_timer_->Stop(); |
149 } else if (event->type() == ui::ET_MOUSEWHEEL && | 149 } else if (event->type() == ui::ET_MOUSEWHEEL && |
150 autoclick_timer_->IsRunning()) { | 150 autoclick_timer_->IsRunning()) { |
151 autoclick_timer_->Reset(); | 151 autoclick_timer_->Reset(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void AutoclickControllerImpl::OnKeyEvent(ui::KeyEvent* event) { | 155 void AutoclickControllerImpl::OnKeyEvent(ui::KeyEvent* event) { |
156 int modifier_mask = | 156 int modifier_mask = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | |
157 ui::EF_SHIFT_DOWN | | 157 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | |
158 ui::EF_CONTROL_DOWN | | 158 ui::EF_IS_EXTENDED_KEY; |
159 ui::EF_ALT_DOWN | | |
160 ui::EF_COMMAND_DOWN | | |
161 ui::EF_EXTENDED; | |
162 int new_modifiers = event->flags() & modifier_mask; | 159 int new_modifiers = event->flags() & modifier_mask; |
163 mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers; | 160 mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers; |
164 | 161 |
165 if (!IsModifierKey(event->key_code())) | 162 if (!IsModifierKey(event->key_code())) |
166 autoclick_timer_->Stop(); | 163 autoclick_timer_->Stop(); |
167 } | 164 } |
168 | 165 |
169 void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) { | 166 void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) { |
170 autoclick_timer_->Stop(); | 167 autoclick_timer_->Stop(); |
171 } | 168 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (details.dispatcher_destroyed) | 204 if (details.dispatcher_destroyed) |
208 return; | 205 return; |
209 } | 206 } |
210 | 207 |
211 // static. | 208 // static. |
212 AutoclickController* AutoclickController::CreateInstance() { | 209 AutoclickController* AutoclickController::CreateInstance() { |
213 return new AutoclickControllerImpl(); | 210 return new AutoclickControllerImpl(); |
214 } | 211 } |
215 | 212 |
216 } // namespace ash | 213 } // namespace ash |
OLD | NEW |