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

Side by Side Diff: ash/autoclick/autoclick_controller.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers; 147 mouse_event_flags_ = (mouse_event_flags_ & ~modifier_mask) | new_modifiers;
148 } 148 }
149 149
150 void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) { 150 void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) {
151 autoclick_timer_->Stop(); 151 autoclick_timer_->Stop();
152 } 152 }
153 153
154 void AutoclickControllerImpl::DoAutoclick() { 154 void AutoclickControllerImpl::DoAutoclick() {
155 gfx::Point screen_location = 155 gfx::Point screen_location =
156 aura::Env::GetInstance()->last_mouse_location(); 156 aura::Env::GetInstance()->last_mouse_location();
157 aura::RootWindow* root_window = wm::GetRootWindowAt(screen_location); 157 aura::Window* root_window = wm::GetRootWindowAt(screen_location);
158 DCHECK(root_window) << "Root window not found while attempting autoclick."; 158 DCHECK(root_window) << "Root window not found while attempting autoclick.";
159 159
160 gfx::Point click_location(screen_location); 160 gfx::Point click_location(screen_location);
161 anchor_location_ = click_location; 161 anchor_location_ = click_location;
162 wm::ConvertPointFromScreen(root_window, &click_location); 162 wm::ConvertPointFromScreen(root_window, &click_location);
163 root_window->ConvertPointToHost(&click_location); 163
164 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher();
165 dispatcher->ConvertPointToHost(&click_location);
164 166
165 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, 167 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED,
166 click_location, 168 click_location,
167 click_location, 169 click_location,
168 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON); 170 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON);
169 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, 171 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED,
170 click_location, 172 click_location,
171 click_location, 173 click_location,
172 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON); 174 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON);
173 175
174 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&press_event); 176 dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press_event);
175 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&release_event); 177 dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release_event);
176 } 178 }
177 179
178 // static. 180 // static.
179 AutoclickController* AutoclickController::CreateInstance() { 181 AutoclickController* AutoclickController::CreateInstance() {
180 return new AutoclickControllerImpl(); 182 return new AutoclickControllerImpl();
181 } 183 }
182 184
183 } // namespace ash 185 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/nested_dispatcher_controller_unittest.cc ('k') | ash/autoclick/autoclick_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698