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

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

Issue 2900423002: [mus+ash] Removes WmWindow from ash/wm/root_window_finder.h (Closed)
Patch Set: Remove WmWindow from ash/wm/root_window_finder.h (tab drag test) Created 3 years, 7 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
« no previous file with comments | « no previous file | ash/display/screen_ash.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autoclick/common/autoclick_controller_common.h" 7 #include "ash/autoclick/common/autoclick_controller_common.h"
8 #include "ash/autoclick/common/autoclick_controller_common_delegate.h" 8 #include "ash/autoclick/common/autoclick_controller_common_delegate.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/root_window_finder.h" 11 #include "ash/wm/root_window_finder.h"
12 #include "ash/wm_window.h"
13 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
14 #include "ui/aura/window_observer.h" 13 #include "ui/aura/window_observer.h"
15 #include "ui/aura/window_tree_host.h" 14 #include "ui/aura/window_tree_host.h"
16 #include "ui/events/event.h" 15 #include "ui/events/event.h"
17 #include "ui/events/event_handler.h" 16 #include "ui/events/event_handler.h"
18 #include "ui/events/event_sink.h" 17 #include "ui/events/event_sink.h"
19 #include "ui/events/event_utils.h" 18 #include "ui/events/event_utils.h"
20 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
21 #include "ui/wm/core/coordinate_conversion.h" 20 #include "ui/wm/core/coordinate_conversion.h"
22 21
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void AutoclickControllerImpl::OnGestureEvent(ui::GestureEvent* event) { 130 void AutoclickControllerImpl::OnGestureEvent(ui::GestureEvent* event) {
132 autoclick_controller_common_->CancelAutoclick(); 131 autoclick_controller_common_->CancelAutoclick();
133 } 132 }
134 133
135 void AutoclickControllerImpl::OnScrollEvent(ui::ScrollEvent* event) { 134 void AutoclickControllerImpl::OnScrollEvent(ui::ScrollEvent* event) {
136 autoclick_controller_common_->CancelAutoclick(); 135 autoclick_controller_common_->CancelAutoclick();
137 } 136 }
138 137
139 views::Widget* AutoclickControllerImpl::CreateAutoclickRingWidget( 138 views::Widget* AutoclickControllerImpl::CreateAutoclickRingWidget(
140 const gfx::Point& event_location) { 139 const gfx::Point& event_location) {
141 aura::Window* target = 140 aura::Window* target = ash::wm::GetRootWindowAt(event_location);
142 WmWindow::GetAuraWindow(ash::wm::GetRootWindowAt(event_location));
143 SetTapDownTarget(target); 141 SetTapDownTarget(target);
144 aura::Window* root_window = target->GetRootWindow(); 142 aura::Window* root_window = target->GetRootWindow();
145 widget_.reset(new views::Widget); 143 widget_.reset(new views::Widget);
146 views::Widget::InitParams params; 144 views::Widget::InitParams params;
147 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; 145 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
148 params.accept_events = false; 146 params.accept_events = false;
149 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; 147 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
150 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 148 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
151 params.context = root_window; 149 params.context = root_window;
152 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 150 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
153 params.parent = 151 params.parent =
154 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer); 152 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer);
155 widget_->Init(params); 153 widget_->Init(params);
156 widget_->SetOpacity(1.f); 154 widget_->SetOpacity(1.f);
157 return widget_.get(); 155 return widget_.get();
158 } 156 }
159 157
160 void AutoclickControllerImpl::UpdateAutoclickRingWidget( 158 void AutoclickControllerImpl::UpdateAutoclickRingWidget(
161 views::Widget* widget, 159 views::Widget* widget,
162 const gfx::Point& event_location) { 160 const gfx::Point& event_location) {
163 aura::Window* target = 161 aura::Window* target = ash::wm::GetRootWindowAt(event_location);
164 WmWindow::GetAuraWindow(ash::wm::GetRootWindowAt(event_location));
165 SetTapDownTarget(target); 162 SetTapDownTarget(target);
166 aura::Window* root_window = target->GetRootWindow(); 163 aura::Window* root_window = target->GetRootWindow();
167 if (widget->GetNativeView()->GetRootWindow() != root_window) { 164 if (widget->GetNativeView()->GetRootWindow() != root_window) {
168 views::Widget::ReparentNativeView( 165 views::Widget::ReparentNativeView(
169 widget->GetNativeView(), 166 widget->GetNativeView(),
170 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer)); 167 Shell::GetContainer(root_window, kShellWindowId_OverlayContainer));
171 } 168 }
172 } 169 }
173 170
174 void AutoclickControllerImpl::DoAutoclick(const gfx::Point& event_location, 171 void AutoclickControllerImpl::DoAutoclick(const gfx::Point& event_location,
175 const int mouse_event_flags) { 172 const int mouse_event_flags) {
176 aura::Window* root_window = 173 aura::Window* root_window = wm::GetRootWindowAt(event_location);
177 WmWindow::GetAuraWindow(wm::GetRootWindowAt(event_location));
178 DCHECK(root_window) << "Root window not found while attempting autoclick."; 174 DCHECK(root_window) << "Root window not found while attempting autoclick.";
179 175
180 gfx::Point click_location(event_location); 176 gfx::Point click_location(event_location);
181 ::wm::ConvertPointFromScreen(root_window, &click_location); 177 ::wm::ConvertPointFromScreen(root_window, &click_location);
182 aura::WindowTreeHost* host = root_window->GetHost(); 178 aura::WindowTreeHost* host = root_window->GetHost();
183 host->ConvertDIPToPixels(&click_location); 179 host->ConvertDIPToPixels(&click_location);
184 180
185 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, 181 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location,
186 click_location, ui::EventTimeForNow(), 182 click_location, ui::EventTimeForNow(),
187 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, 183 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON,
(...skipping 19 matching lines...) Expand all
207 DCHECK_EQ(tap_down_target_, window); 203 DCHECK_EQ(tap_down_target_, window);
208 autoclick_controller_common_->CancelAutoclick(); 204 autoclick_controller_common_->CancelAutoclick();
209 } 205 }
210 206
211 // static. 207 // static.
212 AutoclickController* AutoclickController::CreateInstance() { 208 AutoclickController* AutoclickController::CreateInstance() {
213 return new AutoclickControllerImpl(); 209 return new AutoclickControllerImpl();
214 } 210 }
215 211
216 } // namespace ash 212 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/screen_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698