Chromium Code Reviews| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 } | 165 } |
| 166 | 166 |
| 167 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const { | 167 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const { |
| 168 return last_ripple_triggering_event_ | 168 return last_ripple_triggering_event_ |
| 169 ? last_ripple_triggering_event_->location() | 169 ? last_ripple_triggering_event_->location() |
| 170 : GetLocalBounds().CenterPoint(); | 170 : GetLocalBounds().CenterPoint(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void InkDropHostView::AnimateInkDrop(InkDropState state, | 173 void InkDropHostView::AnimateInkDrop(InkDropState state, |
| 174 const ui::LocatedEvent* event) { | 174 const ui::LocatedEvent* event) { |
| 175 #if defined(OS_WIN) | |
| 176 if ((state == InkDropState::ACTION_PENDING || | |
|
sky
2016/06/24 19:21:11
Is there a reason why you care about the state in
Evan Stade
2016/06/24 20:28:30
I imagine this is to handle cases like if you were
kylix_rd
2016/06/24 20:32:18
Only certain states or actions should be allowed t
| |
| 177 state == InkDropState::ALTERNATE_ACTION_PENDING || | |
| 178 ((state == InkDropState::ACTION_TRIGGERED || | |
| 179 state == InkDropState::ALTERNATE_ACTION_TRIGGERED) && | |
| 180 ink_drop_->GetTargetInkDropState() == InkDropState::HIDDEN)) && | |
| 181 event && event->IsGestureEvent()) | |
| 182 return; | |
| 183 #endif | |
| 175 last_ripple_triggering_event_.reset( | 184 last_ripple_triggering_event_.reset( |
| 176 event ? ui::Event::Clone(*event).release()->AsLocatedEvent() : nullptr); | 185 event ? ui::Event::Clone(*event).release()->AsLocatedEvent() : nullptr); |
| 177 ink_drop_->AnimateToState(state); | 186 ink_drop_->AnimateToState(state); |
| 178 } | 187 } |
| 179 | 188 |
| 180 void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) { | 189 void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) { |
| 181 View::VisibilityChanged(starting_from, is_visible); | 190 View::VisibilityChanged(starting_from, is_visible); |
| 182 if (GetWidget() && !is_visible) { | 191 if (GetWidget() && !is_visible) { |
| 183 ink_drop()->AnimateToState(InkDropState::HIDDEN); | 192 ink_drop()->AnimateToState(InkDropState::HIDDEN); |
| 184 ink_drop()->SetHovered(false); | 193 ink_drop()->SetHovered(false); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 if (has_an_ink_drop) { | 233 if (has_an_ink_drop) { |
| 225 ink_drop_.reset(new InkDropImpl(this)); | 234 ink_drop_.reset(new InkDropImpl(this)); |
| 226 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); | 235 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
| 227 } else { | 236 } else { |
| 228 gesture_handler_.reset(); | 237 gesture_handler_.reset(); |
| 229 ink_drop_.reset(new InkDropStub()); | 238 ink_drop_.reset(new InkDropStub()); |
| 230 } | 239 } |
| 231 } | 240 } |
| 232 | 241 |
| 233 } // namespace views | 242 } // namespace views |
| OLD | NEW |