| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/animation/ink_drop_host_view.h" | 5 #include "ui/views/animation/ink_drop_host_view.h" |
| 6 | 6 |
| 7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
| 8 #include "ui/events/scoped_target_handler.h" | 8 #include "ui/events/scoped_target_handler.h" |
| 9 #include "ui/gfx/color_palette.h" | 9 #include "ui/gfx/color_palette.h" |
| 10 #include "ui/gfx/geometry/size_conversions.h" | 10 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight() | 137 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight() |
| 138 const { | 138 const { |
| 139 std::unique_ptr<InkDropHighlight> highlight( | 139 std::unique_ptr<InkDropHighlight> highlight( |
| 140 new InkDropHighlight(ink_drop_size_, kInkDropSmallCornerRadius, | 140 new InkDropHighlight(ink_drop_size_, kInkDropSmallCornerRadius, |
| 141 GetInkDropCenter(), GetInkDropBaseColor())); | 141 GetInkDropCenter(), GetInkDropBaseColor())); |
| 142 highlight->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_)); | 142 highlight->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_)); |
| 143 return highlight; | 143 return highlight; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) { |
| 147 View::VisibilityChanged(starting_from, is_visible); |
| 148 if (GetWidget() && !is_visible) { |
| 149 ink_drop()->AnimateToState(InkDropState::HIDDEN); |
| 150 ink_drop()->SetHovered(false); |
| 151 } |
| 152 } |
| 153 |
| 146 void InkDropHostView::OnFocus() { | 154 void InkDropHostView::OnFocus() { |
| 147 views::View::OnFocus(); | 155 views::View::OnFocus(); |
| 148 if (ShouldShowInkDropForFocus()) | 156 if (ShouldShowInkDropForFocus()) |
| 149 ink_drop()->SetFocused(true); | 157 ink_drop()->SetFocused(true); |
| 150 } | 158 } |
| 151 | 159 |
| 152 void InkDropHostView::OnBlur() { | 160 void InkDropHostView::OnBlur() { |
| 153 views::View::OnBlur(); | 161 views::View::OnBlur(); |
| 154 if (ShouldShowInkDropForFocus()) | 162 if (ShouldShowInkDropForFocus()) |
| 155 ink_drop()->SetFocused(false); | 163 ink_drop()->SetFocused(false); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 gesture_handler_.reset(); | 198 gesture_handler_.reset(); |
| 191 ink_drop_.reset(new InkDropStub()); | 199 ink_drop_.reset(new InkDropStub()); |
| 192 } | 200 } |
| 193 } | 201 } |
| 194 | 202 |
| 195 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { | 203 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { |
| 196 ink_drop_->AnimateToState(ink_drop_state); | 204 ink_drop_->AnimateToState(ink_drop_state); |
| 197 } | 205 } |
| 198 | 206 |
| 199 } // namespace views | 207 } // namespace views |
| OLD | NEW |