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/root_window_controller.h" |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
| 11 #include "ash/wm/property_util.h" |
10 #include "ash/wm/shelf_layout_manager.h" | 12 #include "ash/wm/shelf_layout_manager.h" |
11 #include "ash/wm/window_animations.h" | 13 #include "ash/wm/window_animations.h" |
12 #include "grit/ash_strings.h" | 14 #include "grit/ash_strings.h" |
13 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
15 #include "third_party/skia/include/core/SkPaint.h" | 17 #include "third_party/skia/include/core/SkPaint.h" |
16 #include "third_party/skia/include/core/SkPath.h" | 18 #include "third_party/skia/include/core/SkPath.h" |
17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 19 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
18 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
19 #include "ui/base/accessibility/accessible_view_state.h" | 21 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 458 } |
457 | 459 |
458 bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, | 460 bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, |
459 ui::KeyEvent* event) { | 461 ui::KeyEvent* event) { |
460 return false; | 462 return false; |
461 } | 463 } |
462 | 464 |
463 bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, | 465 bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, |
464 ui::MouseEvent* event) { | 466 ui::MouseEvent* event) { |
465 if (event->type() == ui::ET_MOUSE_PRESSED) | 467 if (event->type() == ui::ET_MOUSE_PRESSED) |
466 ProcessLocatedEvent(*event); | 468 ProcessLocatedEvent(target, *event); |
467 return false; | 469 return false; |
468 } | 470 } |
469 | 471 |
470 ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( | 472 ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( |
471 aura::Window* target, | 473 aura::Window* target, |
472 ui::TouchEvent* event) { | 474 ui::TouchEvent* event) { |
473 if (event->type() == ui::ET_TOUCH_PRESSED) | 475 if (event->type() == ui::ET_TOUCH_PRESSED) |
474 ProcessLocatedEvent(*event); | 476 ProcessLocatedEvent(target, *event); |
475 return ui::TOUCH_STATUS_UNKNOWN; | 477 return ui::TOUCH_STATUS_UNKNOWN; |
476 } | 478 } |
477 | 479 |
478 ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( | 480 ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( |
479 aura::Window* target, | 481 aura::Window* target, |
480 ui::GestureEvent* event) { | 482 ui::GestureEvent* event) { |
481 return ui::GESTURE_STATUS_UNKNOWN; | 483 return ui::GESTURE_STATUS_UNKNOWN; |
482 } | 484 } |
483 | 485 |
484 void TrayBubbleView::Host::ProcessLocatedEvent( | 486 void TrayBubbleView::Host::ProcessLocatedEvent( |
485 const ui::LocatedEvent& event) { | 487 aura::Window* target, const ui::LocatedEvent& event) { |
| 488 if (target) { |
| 489 // Don't process events that occurred inside an embedded menu. |
| 490 RootWindowController* root_controller = |
| 491 GetRootWindowController(target->GetRootWindow()); |
| 492 if (root_controller && root_controller->GetContainer( |
| 493 ash::internal::kShellWindowId_MenuContainer)->Contains(target)) { |
| 494 return; |
| 495 } |
| 496 } |
486 if (!widget_) | 497 if (!widget_) |
487 return; | 498 return; |
488 gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); | 499 gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); |
489 if (bounds.Contains(event.root_location())) | 500 if (bounds.Contains(event.root_location())) |
490 return; | 501 return; |
491 if (tray_view_) { | 502 if (tray_view_) { |
492 // If the user clicks on the parent tray, don't process the event here, | 503 // 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. | 504 // let the tray logic handle the event and determine show/hide behavior. |
494 bounds = tray_view_->ConvertRectToWidget(tray_view_->GetLocalBounds()); | 505 bounds = tray_view_->ConvertRectToWidget(tray_view_->GetLocalBounds()); |
495 if (bounds.Contains(event.location())) | 506 if (bounds.Contains(event.location())) |
496 return; | 507 return; |
497 } | 508 } |
498 // Handle clicking outside the bubble and tray. We don't block the event, so | 509 // 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. | 510 // it will also be handled by whatever widget was clicked on. |
500 OnClickedOutsideView(); | 511 OnClickedOutsideView(); |
501 } | 512 } |
502 | 513 |
503 | 514 |
504 } // namespace internal | 515 } // namespace internal |
505 } // namespace ash | 516 } // namespace ash |
OLD | NEW |