| 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 "ui/views/bubble/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
| 12 #include "third_party/skia/include/core/SkPaint.h" | 12 #include "third_party/skia/include/core/SkPaint.h" |
| 13 #include "third_party/skia/include/core/SkPath.h" | 13 #include "third_party/skia/include/core/SkPath.h" |
| 14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 15 #include "ui/accessibility/ax_view_state.h" | 15 #include "ui/accessibility/ax_node_data.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 18 #include "ui/compositor/layer_delegate.h" | 18 #include "ui/compositor/layer_delegate.h" |
| 19 #include "ui/compositor/paint_recorder.h" | 19 #include "ui/compositor/paint_recorder.h" |
| 20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
| 21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 22 #include "ui/gfx/geometry/insets.h" | 22 #include "ui/gfx/geometry/insets.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
| 24 #include "ui/gfx/path.h" | 24 #include "ui/gfx/path.h" |
| 25 #include "ui/gfx/skia_util.h" | 25 #include "ui/gfx/skia_util.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 481 |
| 482 void TrayBubbleView::OnMouseExited(const ui::MouseEvent& event) { | 482 void TrayBubbleView::OnMouseExited(const ui::MouseEvent& event) { |
| 483 // If there was a mouse watcher waiting for mouse movements we disable it | 483 // If there was a mouse watcher waiting for mouse movements we disable it |
| 484 // immediately since we now leave the bubble. | 484 // immediately since we now leave the bubble. |
| 485 mouse_watcher_.reset(); | 485 mouse_watcher_.reset(); |
| 486 // Do not notify the delegate of an exit if we never told it that we entered. | 486 // Do not notify the delegate of an exit if we never told it that we entered. |
| 487 if (delegate_ && mouse_actively_entered_) | 487 if (delegate_ && mouse_actively_entered_) |
| 488 delegate_->OnMouseExitedView(); | 488 delegate_->OnMouseExitedView(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 void TrayBubbleView::GetAccessibleState(ui::AXViewState* state) { | 491 void TrayBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 492 if (delegate_ && CanActivate()) { | 492 if (delegate_ && CanActivate()) { |
| 493 state->role = ui::AX_ROLE_WINDOW; | 493 node_data->role = ui::AX_ROLE_WINDOW; |
| 494 state->name = delegate_->GetAccessibleNameForBubble(); | 494 node_data->SetName(delegate_->GetAccessibleNameForBubble()); |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 void TrayBubbleView::MouseMovedOutOfHost() { | 498 void TrayBubbleView::MouseMovedOutOfHost() { |
| 499 // The mouse was accidentally over the bubble when it opened and the AutoClose | 499 // The mouse was accidentally over the bubble when it opened and the AutoClose |
| 500 // logic was not activated. Now that the user did move the mouse we tell the | 500 // logic was not activated. Now that the user did move the mouse we tell the |
| 501 // delegate to disable AutoClose. | 501 // delegate to disable AutoClose. |
| 502 delegate_->OnMouseEnteredView(); | 502 delegate_->OnMouseEnteredView(); |
| 503 mouse_actively_entered_ = true; | 503 mouse_actively_entered_ = true; |
| 504 mouse_watcher_->Stop(); | 504 mouse_watcher_->Stop(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void TrayBubbleView::ChildPreferredSizeChanged(View* child) { | 507 void TrayBubbleView::ChildPreferredSizeChanged(View* child) { |
| 508 SizeToContents(); | 508 SizeToContents(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void TrayBubbleView::ViewHierarchyChanged( | 511 void TrayBubbleView::ViewHierarchyChanged( |
| 512 const ViewHierarchyChangedDetails& details) { | 512 const ViewHierarchyChangedDetails& details) { |
| 513 if (details.is_add && details.child == this) { | 513 if (details.is_add && details.child == this) { |
| 514 details.parent->SetPaintToLayer(true); | 514 details.parent->SetPaintToLayer(true); |
| 515 details.parent->layer()->SetMasksToBounds(true); | 515 details.parent->layer()->SetMasksToBounds(true); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace views | 519 } // namespace views |
| OLD | NEW |