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/system/tray/tray_bubble_view.h" | 5 #include "ash/system/tray/tray_bubble_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/wm/shelf_layout_manager.h" | 10 #include "ash/wm/shelf_layout_manager.h" |
11 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
12 #include "grit/ash_strings.h" | 12 #include "grit/ash_strings.h" |
13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "third_party/skia/include/core/SkPaint.h" | 15 #include "third_party/skia/include/core/SkPaint.h" |
16 #include "third_party/skia/include/core/SkPath.h" | 16 #include "third_party/skia/include/core/SkPath.h" |
17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
18 #include "ui/aura/event.h" | |
19 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
20 #include "ui/base/accessibility/accessible_view_state.h" | 19 #include "ui/base/accessibility/accessible_view_state.h" |
| 20 #include "ui/base/event.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/insets.h" | 23 #include "ui/gfx/insets.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
25 #include "ui/views/bubble/bubble_frame_view.h" | 25 #include "ui/views/bubble/bubble_frame_view.h" |
26 #include "ui/views/layout/box_layout.h" | 26 #include "ui/views/layout/box_layout.h" |
27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
30 | 30 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 ash::ANIMATE_BOTH); | 449 ash::ANIMATE_BOTH); |
450 ash::SetWindowVisibilityAnimationDuration( | 450 ash::SetWindowVisibilityAnimationDuration( |
451 widget->GetNativeWindow(), | 451 widget->GetNativeWindow(), |
452 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS)); | 452 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS)); |
453 | 453 |
454 bubble_view->Show(); | 454 bubble_view->Show(); |
455 bubble_view->UpdateBubble(); | 455 bubble_view->UpdateBubble(); |
456 } | 456 } |
457 | 457 |
458 bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, | 458 bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, |
459 aura::KeyEvent* event) { | 459 ui::KeyEvent* event) { |
460 return false; | 460 return false; |
461 } | 461 } |
462 | 462 |
463 bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, | 463 bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, |
464 aura::MouseEvent* event) { | 464 ui::MouseEvent* event) { |
465 if (event->type() == ui::ET_MOUSE_PRESSED) | 465 if (event->type() == ui::ET_MOUSE_PRESSED) |
466 ProcessLocatedEvent(*event); | 466 ProcessLocatedEvent(*event); |
467 return false; | 467 return false; |
468 } | 468 } |
469 | 469 |
470 ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( | 470 ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( |
471 aura::Window* target, | 471 aura::Window* target, |
472 aura::TouchEvent* event) { | 472 ui::TouchEventImpl* event) { |
473 if (event->type() == ui::ET_TOUCH_PRESSED) | 473 if (event->type() == ui::ET_TOUCH_PRESSED) |
474 ProcessLocatedEvent(*event); | 474 ProcessLocatedEvent(*event); |
475 return ui::TOUCH_STATUS_UNKNOWN; | 475 return ui::TOUCH_STATUS_UNKNOWN; |
476 } | 476 } |
477 | 477 |
478 ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( | 478 ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( |
479 aura::Window* target, | 479 aura::Window* target, |
480 aura::GestureEvent* event) { | 480 ui::GestureEventImpl* event) { |
481 return ui::GESTURE_STATUS_UNKNOWN; | 481 return ui::GESTURE_STATUS_UNKNOWN; |
482 } | 482 } |
483 | 483 |
484 void TrayBubbleView::Host::ProcessLocatedEvent( | 484 void TrayBubbleView::Host::ProcessLocatedEvent( |
485 const aura::LocatedEvent& event) { | 485 const ui::LocatedEvent& event) { |
486 if (!widget_) | 486 if (!widget_) |
487 return; | 487 return; |
488 gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); | 488 gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); |
489 if (bounds.Contains(event.root_location())) | 489 if (bounds.Contains(event.root_location())) |
490 return; | 490 return; |
491 if (tray_view_) { | 491 if (tray_view_) { |
492 // If the user clicks on the parent tray, don't process the event here, | 492 // If the user clicks on the parent tray, don't process the event here, |
493 // let the tray logic handle the event and determine show/hide behavior. | 493 // let the tray logic handle the event and determine show/hide behavior. |
494 bounds = tray_view_->ConvertRectToWidget(tray_view_->GetLocalBounds()); | 494 bounds = tray_view_->ConvertRectToWidget(tray_view_->GetLocalBounds()); |
495 if (bounds.Contains(event.location())) | 495 if (bounds.Contains(event.location())) |
496 return; | 496 return; |
497 } | 497 } |
498 // Handle clicking outside the bubble and tray. We don't block the event, so | 498 // Handle clicking outside the bubble and tray. We don't block the event, so |
499 // it will also be handled by whatever widget was clicked on. | 499 // it will also be handled by whatever widget was clicked on. |
500 OnClickedOutsideView(); | 500 OnClickedOutsideView(); |
501 } | 501 } |
502 | 502 |
503 | 503 |
504 } // namespace internal | 504 } // namespace internal |
505 } // namespace ash | 505 } // namespace ash |
OLD | NEW |