OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/launcher/launcher_tooltip_manager.h" | 5 #include "ash/launcher/launcher_tooltip_manager.h" |
6 | 6 |
7 #include "ash/launcher/launcher_view.h" | 7 #include "ash/launcher/launcher_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/session_state_controller.h" | 10 #include "ash/wm/session_state_controller.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 timer_.reset(); | 236 timer_.reset(); |
237 } | 237 } |
238 | 238 |
239 bool LauncherTooltipManager::IsVisible() { | 239 bool LauncherTooltipManager::IsVisible() { |
240 if (timer_.get() && timer_->IsRunning()) | 240 if (timer_.get() && timer_->IsRunning()) |
241 return false; | 241 return false; |
242 | 242 |
243 return widget_ && widget_->IsVisible(); | 243 return widget_ && widget_->IsVisible(); |
244 } | 244 } |
245 | 245 |
246 ui::EventResult LauncherTooltipManager::OnMouseEvent(ui::MouseEvent* event) { | 246 void LauncherTooltipManager::OnMouseEvent(ui::MouseEvent* event) { |
247 DCHECK(event->target()); | 247 DCHECK(event->target()); |
248 DCHECK(event); | 248 DCHECK(event); |
249 if (!widget_ || !widget_->IsVisible()) | 249 if (!widget_ || !widget_->IsVisible()) |
250 return ui::ER_UNHANDLED; | 250 return; |
251 | 251 |
252 DCHECK(view_); | 252 DCHECK(view_); |
253 DCHECK(launcher_view_); | 253 DCHECK(launcher_view_); |
254 | 254 |
255 aura::Window* target = static_cast<aura::Window*>(event->target()); | 255 aura::Window* target = static_cast<aura::Window*>(event->target()); |
256 if (widget_->GetNativeWindow()->GetRootWindow() != target->GetRootWindow()) { | 256 if (widget_->GetNativeWindow()->GetRootWindow() != target->GetRootWindow()) { |
257 CloseSoon(); | 257 CloseSoon(); |
258 return ui::ER_UNHANDLED; | 258 return; |
259 } | 259 } |
260 | 260 |
261 gfx::Point location_in_launcher_view = event->location(); | 261 gfx::Point location_in_launcher_view = event->location(); |
262 aura::Window::ConvertPointToTarget( | 262 aura::Window::ConvertPointToTarget( |
263 target, launcher_view_->GetWidget()->GetNativeWindow(), | 263 target, launcher_view_->GetWidget()->GetNativeWindow(), |
264 &location_in_launcher_view); | 264 &location_in_launcher_view); |
265 | 265 |
266 gfx::Point location_on_screen = event->location(); | 266 gfx::Point location_on_screen = event->location(); |
267 aura::Window::ConvertPointToTarget( | 267 aura::Window::ConvertPointToTarget( |
268 target, target->GetRootWindow(), &location_on_screen); | 268 target, target->GetRootWindow(), &location_on_screen); |
269 gfx::Rect bubble_rect = widget_->GetWindowBoundsInScreen(); | 269 gfx::Rect bubble_rect = widget_->GetWindowBoundsInScreen(); |
270 | 270 |
271 if (launcher_view_->ShouldHideTooltip(location_in_launcher_view) && | 271 if (launcher_view_->ShouldHideTooltip(location_in_launcher_view) && |
272 !bubble_rect.Contains(location_on_screen)) { | 272 !bubble_rect.Contains(location_on_screen)) { |
273 // Because this mouse event may arrive to |view_|, here we just schedule | 273 // Because this mouse event may arrive to |view_|, here we just schedule |
274 // the closing event rather than directly calling Close(). | 274 // the closing event rather than directly calling Close(). |
275 CloseSoon(); | 275 CloseSoon(); |
276 } | 276 } |
277 | |
278 return ui::ER_UNHANDLED; | |
279 } | 277 } |
280 | 278 |
281 void LauncherTooltipManager::OnTouchEvent(ui::TouchEvent* event) { | 279 void LauncherTooltipManager::OnTouchEvent(ui::TouchEvent* event) { |
282 aura::Window* target = static_cast<aura::Window*>(event->target()); | 280 aura::Window* target = static_cast<aura::Window*>(event->target()); |
283 if (widget_ && widget_->IsVisible() && widget_->GetNativeWindow() != target) | 281 if (widget_ && widget_->IsVisible() && widget_->GetNativeWindow() != target) |
284 Close(); | 282 Close(); |
285 } | 283 } |
286 | 284 |
287 void LauncherTooltipManager::OnGestureEvent(ui::GestureEvent* event) { | 285 void LauncherTooltipManager::OnGestureEvent(ui::GestureEvent* event) { |
288 if (widget_ && widget_->IsVisible()) { | 286 if (widget_ && widget_->IsVisible()) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 360 |
363 gfx::NativeView native_view = widget_->GetNativeView(); | 361 gfx::NativeView native_view = widget_->GetNativeView(); |
364 views::corewm::SetWindowVisibilityAnimationType( | 362 views::corewm::SetWindowVisibilityAnimationType( |
365 native_view, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 363 native_view, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
366 views::corewm::SetWindowVisibilityAnimationTransition( | 364 views::corewm::SetWindowVisibilityAnimationTransition( |
367 native_view, views::corewm::ANIMATE_HIDE); | 365 native_view, views::corewm::ANIMATE_HIDE); |
368 } | 366 } |
369 | 367 |
370 } // namespace internal | 368 } // namespace internal |
371 } // namespace ash | 369 } // namespace ash |
OLD | NEW |