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

Unified Diff: ash/autoclick/common/autoclick_controller_common.cc

Issue 2316553003: mash: Add autoclick app. (Closed)
Patch Set: MouseEvent; if etc. Created 4 years, 3 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/autoclick/common/autoclick_controller_common.cc
diff --git a/ash/autoclick/common/autoclick_controller_common.cc b/ash/autoclick/common/autoclick_controller_common.cc
index d622814b3b647e19ce6a238e1567129d7388097a..d02509ddd5dc23605bb012f156f495806568657e 100644
--- a/ash/autoclick/common/autoclick_controller_common.cc
+++ b/ash/autoclick/common/autoclick_controller_common.cc
@@ -50,9 +50,12 @@ void AutoclickControllerCommon::HandleMouseEvent(const ui::MouseEvent& event) {
mouse_event_flags_ = event.flags();
// TODO(riajiang): Make getting screen location work for mus as well.
- // (crbug.com/608547)
- ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event.target()),
- &mouse_location);
+ // Also switch to take in a PointerEvent instead of a MouseEvent after
+ // this is done. (crbug.com/608547)
+ if (event.target() != nullptr) {
+ ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event.target()),
+ &mouse_location);
+ }
UpdateRingWidget(mouse_location);
// The distance between the mouse location and the anchor location
@@ -65,10 +68,9 @@ void AutoclickControllerCommon::HandleMouseEvent(const ui::MouseEvent& event) {
if (delta.LengthSquared() >= kMovementThreshold * kMovementThreshold) {
anchor_location_ = mouse_location;
autoclick_timer_->Reset();
- autoclick_ring_handler_->StartGesture(delay_, anchor_location_,
- widget_.get());
+ autoclick_ring_handler_->StartGesture(delay_, anchor_location_, widget_);
} else if (autoclick_timer_->IsRunning()) {
- autoclick_ring_handler_->SetGestureCenter(mouse_location, widget_.get());
+ autoclick_ring_handler_->SetGestureCenter(mouse_location, widget_);
}
} else if (event.type() == ui::ET_MOUSE_PRESSED) {
CancelAutoclick();
@@ -76,8 +78,7 @@ void AutoclickControllerCommon::HandleMouseEvent(const ui::MouseEvent& event) {
autoclick_timer_->IsRunning()) {
autoclick_timer_->Reset();
UpdateRingWidget(mouse_location);
- autoclick_ring_handler_->StartGesture(delay_, anchor_location_,
- widget_.get());
+ autoclick_ring_handler_->StartGesture(delay_, anchor_location_, widget_);
}
}
@@ -120,10 +121,9 @@ void AutoclickControllerCommon::DoAutoclick() {
void AutoclickControllerCommon::UpdateRingWidget(
const gfx::Point& mouse_location) {
if (!widget_) {
- widget_.reset(
- (delegate_->CreateAutoclickRingWidget(mouse_location)).release());
+ widget_ = delegate_->CreateAutoclickRingWidget(mouse_location);
} else {
- delegate_->UpdateAutoclickRingWidget(widget_.get(), mouse_location);
+ delegate_->UpdateAutoclickRingWidget(widget_, mouse_location);
}
}
« no previous file with comments | « ash/autoclick/common/autoclick_controller_common.h ('k') | ash/autoclick/common/autoclick_controller_common_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698