14e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 24e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 34e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// found in the LICENSE file. 44e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 54e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ash/autoclick/autoclick_controller.h" 64e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ash/shell.h" 84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ash/wm/coordinate_conversion.h" 94e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "base/timer/timer.h" 104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/aura/env.h" 1123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "ui/aura/window_tree_host.h" 124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/events/event.h" 134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/events/event_constants.h" 144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/events/event_handler.h" 1523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "ui/events/event_processor.h" 164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/gfx/point.h" 171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/gfx/vector2d.h" 186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "ui/wm/core/coordinate_conversion.h" 194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace ash { 214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace { 231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// The threshold of mouse movement measured in DIP that will 251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// initiate a new autoclick. 261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)const int kMovementThreshold = 20; 271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)bool IsModifierKey(ui::KeyboardCode key_code) { 291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return key_code == ui::VKEY_SHIFT || 301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_LSHIFT || 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_CONTROL || 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_LCONTROL || 331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_RCONTROL || 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_MENU || 351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_LMENU || 361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) key_code == ui::VKEY_RMENU; 371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} // namespace 401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// static. 428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)const int AutoclickController::kDefaultAutoclickDelayMs = 400; 434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class AutoclickControllerImpl : public AutoclickController, 454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) public ui::EventHandler { 464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) public: 474e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) AutoclickControllerImpl(); 484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual ~AutoclickControllerImpl(); 494e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) private: 514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // AutoclickController overrides: 524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void SetEnabled(bool enabled) OVERRIDE; 534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual bool IsEnabled() const OVERRIDE; 548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void SetAutoclickDelay(int delay_ms) OVERRIDE; 558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual int GetAutoclickDelay() const OVERRIDE; 564e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 574e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // ui::EventHandler overrides: 584e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 594e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; 604e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 611e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 621e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; 634e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 644e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) void InitClickTimer(); 654e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 664e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) void DoAutoclick(); 674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 684e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) bool enabled_; 698bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) int delay_ms_; 704e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) int mouse_event_flags_; 714e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) scoped_ptr<base::Timer> autoclick_timer_; 721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // The position in screen coordinates used to determine 731e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // the distance the mouse has moved. 741e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) gfx::Point anchor_location_; 754e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 764e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AutoclickControllerImpl); 774e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}; 784e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 794e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 804e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)AutoclickControllerImpl::AutoclickControllerImpl() 814e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) : enabled_(false), 828bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) delay_ms_(kDefaultAutoclickDelayMs), 831e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) mouse_event_flags_(ui::EF_NONE), 841e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) anchor_location_(-kMovementThreshold, -kMovementThreshold) { 854e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) InitClickTimer(); 864e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 874e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 884e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)AutoclickControllerImpl::~AutoclickControllerImpl() { 894e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 904e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 914e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::SetEnabled(bool enabled) { 924e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) if (enabled_ == enabled) 934e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) return; 944e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) enabled_ = enabled; 954e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 964e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) if (enabled_) { 974e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) Shell::GetInstance()->AddPreTargetHandler(this); 984e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_->Stop(); 994e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } else { 1004e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) Shell::GetInstance()->RemovePreTargetHandler(this); 1014e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } 1024e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1034e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1044e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)bool AutoclickControllerImpl::IsEnabled() const { 1054e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) return enabled_; 1064e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1074e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1088bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)void AutoclickControllerImpl::SetAutoclickDelay(int delay_ms) { 1098bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) delay_ms_ = delay_ms; 1104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) InitClickTimer(); 1114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)int AutoclickControllerImpl::GetAutoclickDelay() const { 1148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return delay_ms_; 1154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::InitClickTimer() { 1184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_.reset(new base::Timer( 1194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) FROM_HERE, 1208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) base::TimeDelta::FromMilliseconds(delay_ms_), 1214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) base::Bind(&AutoclickControllerImpl::DoAutoclick, 1224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) base::Unretained(this)), 1234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) false)); 1244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::OnMouseEvent(ui::MouseEvent* event) { 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (event->type() == ui::ET_MOUSE_MOVED && 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) !(event->flags() & ui::EF_IS_SYNTHESIZED)) { 1294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) mouse_event_flags_ = event->flags(); 1301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) gfx::Point mouse_location = event->root_location(); 1326e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) ::wm::ConvertPointToScreen(wm::GetRootWindowAt(mouse_location), 1336e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) &mouse_location); 1341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // The distance between the mouse location and the anchor location 1361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // must exceed a certain threshold to initiate a new autoclick countdown. 1371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // This ensures that mouse jitter caused by poor motor control does not 1381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // 1. initiate an unwanted autoclick from rest 1391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // 2. prevent the autoclick from ever occuring when the mouse 1401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // arrives at the target. 1411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) gfx::Vector2d delta = mouse_location - anchor_location_; 1421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) if (delta.LengthSquared() >= kMovementThreshold * kMovementThreshold) { 1431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) anchor_location_ = event->root_location(); 1441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) autoclick_timer_->Reset(); 1451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) } 1464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } else if (event->type() == ui::ET_MOUSE_PRESSED) { 1474e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_->Stop(); 1484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } else if (event->type() == ui::ET_MOUSEWHEEL && 1494e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_->IsRunning()) { 1504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_->Reset(); 1514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } 1524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1544e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::OnKeyEvent(ui::KeyEvent* event) { 1554e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) int modifier_mask = 1564e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::EF_SHIFT_DOWN | 1574e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::EF_CONTROL_DOWN | 1584e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::EF_ALT_DOWN | 1594e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::EF_COMMAND_DOWN | 1604e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::EF_EXTENDED; 1614e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) int new_modifiers = event->flags() & modifier_mask; 1624e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers; 1631e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1641e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) if (!IsModifierKey(event->key_code())) 1651e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) autoclick_timer_->Stop(); 1664e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1684e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) { 1694e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) autoclick_timer_->Stop(); 1704e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 1714e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)void AutoclickControllerImpl::OnGestureEvent(ui::GestureEvent* event) { 1731e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) autoclick_timer_->Stop(); 1741e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 1751e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1761e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)void AutoclickControllerImpl::OnScrollEvent(ui::ScrollEvent* event) { 1771e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) autoclick_timer_->Stop(); 1781e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 1791e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1804e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void AutoclickControllerImpl::DoAutoclick() { 1814e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) gfx::Point screen_location = 1824e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) aura::Env::GetInstance()->last_mouse_location(); 1831e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) aura::Window* root_window = wm::GetRootWindowAt(screen_location); 1844e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) DCHECK(root_window) << "Root window not found while attempting autoclick."; 1854e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1864e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) gfx::Point click_location(screen_location); 1871e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) anchor_location_ = click_location; 1886e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) ::wm::ConvertPointFromScreen(root_window, &click_location); 1891e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 190a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) aura::WindowTreeHost* host = root_window->GetHost(); 191a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) host->ConvertPointToHost(&click_location); 1924e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1934e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, 1944e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) click_location, 1954e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) click_location, 1965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, 1975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::EF_LEFT_MOUSE_BUTTON); 1984e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, 1994e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) click_location, 2004e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) click_location, 2015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, 2025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::EF_LEFT_MOUSE_BUTTON); 2035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::EventDispatchDetails details = 20523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) host->event_processor()->OnEventFromSource(&press_event); 2065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (!details.dispatcher_destroyed) 20723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) details = host->event_processor()->OnEventFromSource(&release_event); 2085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (details.dispatcher_destroyed) 2095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return; 2104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 2114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 2124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// static. 2134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)AutoclickController* AutoclickController::CreateInstance() { 2144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) return new AutoclickControllerImpl(); 2154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 2164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 2174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} // namespace ash 218