| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/system/tray/actionable_view.h" | 5 #include "ash/common/system/tray/actionable_view.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/system/tray/system_tray_item.h" | 9 #include "ash/common/system/tray/system_tray_item.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ui/accessibility/ax_node_data.h" | 11 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
| 14 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 14 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 15 #include "ui/views/animation/ink_drop_highlight.h" | 15 #include "ui/views/animation/ink_drop_highlight.h" |
| 16 #include "ui/views/animation/ink_drop_impl.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 // static | 20 // static |
| 20 const char ActionableView::kViewClassName[] = "tray/ActionableView"; | 21 const char ActionableView::kViewClassName[] = "tray/ActionableView"; |
| 21 | 22 |
| 22 ActionableView::ActionableView(SystemTrayItem* owner) | 23 ActionableView::ActionableView(SystemTrayItem* owner) |
| 23 : views::CustomButton(this), destroyed_(nullptr), owner_(owner) { | 24 : views::CustomButton(this), destroyed_(nullptr), owner_(owner) { |
| 24 SetFocusBehavior(FocusBehavior::ALWAYS); | 25 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 25 set_has_ink_drop_action_on_click(false); | 26 set_has_ink_drop_action_on_click(false); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // We render differently when focused. | 74 // We render differently when focused. |
| 74 SchedulePaint(); | 75 SchedulePaint(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void ActionableView::OnBlur() { | 78 void ActionableView::OnBlur() { |
| 78 CustomButton::OnBlur(); | 79 CustomButton::OnBlur(); |
| 79 // We render differently when focused. | 80 // We render differently when focused. |
| 80 SchedulePaint(); | 81 SchedulePaint(); |
| 81 } | 82 } |
| 82 | 83 |
| 84 std::unique_ptr<views::InkDrop> ActionableView::CreateInkDrop() { |
| 85 std::unique_ptr<views::InkDropImpl> ink_drop = |
| 86 CreateDefaultFloodFillInkDropImpl(); |
| 87 ink_drop->SetShowHighlightOnHover(false); |
| 88 return std::move(ink_drop); |
| 89 } |
| 90 |
| 83 std::unique_ptr<views::InkDropRipple> ActionableView::CreateInkDropRipple() | 91 std::unique_ptr<views::InkDropRipple> ActionableView::CreateInkDropRipple() |
| 84 const { | 92 const { |
| 85 return base::MakeUnique<views::FloodFillInkDropRipple>( | 93 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 86 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), | 94 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), |
| 87 kTrayPopupInkDropBaseColor, kTrayPopupInkDropRippleOpacity); | 95 kTrayPopupInkDropBaseColor, kTrayPopupInkDropRippleOpacity); |
| 88 } | 96 } |
| 89 | 97 |
| 90 std::unique_ptr<views::InkDropHighlight> | 98 std::unique_ptr<views::InkDropHighlight> |
| 91 ActionableView::CreateInkDropHighlight() const { | 99 ActionableView::CreateInkDropHighlight() const { |
| 92 std::unique_ptr<views::InkDropHighlight> highlight( | 100 std::unique_ptr<views::InkDropHighlight> highlight( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 if (action_performed) { | 121 if (action_performed) { |
| 114 AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED, | 122 AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED, |
| 115 ui::LocatedEvent::FromIfValid(&event)); | 123 ui::LocatedEvent::FromIfValid(&event)); |
| 116 } else { | 124 } else { |
| 117 AnimateInkDrop(views::InkDropState::HIDDEN, | 125 AnimateInkDrop(views::InkDropState::HIDDEN, |
| 118 ui::LocatedEvent::FromIfValid(&event)); | 126 ui::LocatedEvent::FromIfValid(&event)); |
| 119 } | 127 } |
| 120 } | 128 } |
| 121 | 129 |
| 122 } // namespace ash | 130 } // namespace ash |
| OLD | NEW |