Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2178163002: Add ink drop ripple to shelf overflow button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ~InkDropGestureHandler() override {} 51 ~InkDropGestureHandler() override {}
52 52
53 // ui::EventHandler: 53 // ui::EventHandler:
54 void OnGestureEvent(ui::GestureEvent* event) override { 54 void OnGestureEvent(ui::GestureEvent* event) override {
55 InkDropState current_ink_drop_state = 55 InkDropState current_ink_drop_state =
56 host_view_->ink_drop()->GetTargetInkDropState(); 56 host_view_->ink_drop()->GetTargetInkDropState();
57 57
58 InkDropState ink_drop_state = InkDropState::HIDDEN; 58 InkDropState ink_drop_state = InkDropState::HIDDEN;
59 switch (event->type()) { 59 switch (event->type()) {
60 case ui::ET_GESTURE_TAP_DOWN: 60 case ui::ET_GESTURE_TAP_DOWN:
61 if (current_ink_drop_state == InkDropState::ACTIVATED)
62 return;
61 ink_drop_state = InkDropState::ACTION_PENDING; 63 ink_drop_state = InkDropState::ACTION_PENDING;
62 // The ui::ET_GESTURE_TAP_DOWN event needs to be marked as handled so 64 // The ui::ET_GESTURE_TAP_DOWN event needs to be marked as handled so
63 // that 65 // that
64 // subsequent events for the gesture are sent to |this|. 66 // subsequent events for the gesture are sent to |this|.
65 event->SetHandled(); 67 event->SetHandled();
66 break; 68 break;
67 case ui::ET_GESTURE_LONG_PRESS: 69 case ui::ET_GESTURE_LONG_PRESS:
70 if (current_ink_drop_state == InkDropState::ACTIVATED)
71 return;
68 ink_drop_state = InkDropState::ALTERNATE_ACTION_PENDING; 72 ink_drop_state = InkDropState::ALTERNATE_ACTION_PENDING;
69 break; 73 break;
70 case ui::ET_GESTURE_LONG_TAP: 74 case ui::ET_GESTURE_LONG_TAP:
71 ink_drop_state = InkDropState::ALTERNATE_ACTION_TRIGGERED; 75 ink_drop_state = InkDropState::ALTERNATE_ACTION_TRIGGERED;
72 break; 76 break;
73 case ui::ET_GESTURE_END: 77 case ui::ET_GESTURE_END:
78 case ui::ET_GESTURE_SCROLL_BEGIN:
74 if (current_ink_drop_state == InkDropState::ACTIVATED) 79 if (current_ink_drop_state == InkDropState::ACTIVATED)
75 return; 80 return;
76 // Fall through to ui::ET_GESTURE_SCROLL_BEGIN case.
77 case ui::ET_GESTURE_SCROLL_BEGIN:
78 ink_drop_state = InkDropState::HIDDEN; 81 ink_drop_state = InkDropState::HIDDEN;
79 break; 82 break;
80 default: 83 default:
81 return; 84 return;
82 } 85 }
83 86
84 if (ink_drop_state == InkDropState::HIDDEN && 87 if (ink_drop_state == InkDropState::HIDDEN &&
85 (current_ink_drop_state == InkDropState::ACTION_TRIGGERED || 88 (current_ink_drop_state == InkDropState::ACTION_TRIGGERED ||
86 current_ink_drop_state == InkDropState::ALTERNATE_ACTION_TRIGGERED || 89 current_ink_drop_state == InkDropState::ALTERNATE_ACTION_TRIGGERED ||
87 current_ink_drop_state == InkDropState::DEACTIVATED)) { 90 current_ink_drop_state == InkDropState::DEACTIVATED)) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 else 239 else
237 ink_drop_.reset(new InkDropImpl(this)); 240 ink_drop_.reset(new InkDropImpl(this));
238 241
239 if (ink_drop_mode != InkDropMode::ON) 242 if (ink_drop_mode != InkDropMode::ON)
240 gesture_handler_.reset(); 243 gesture_handler_.reset();
241 else if (!gesture_handler_) 244 else if (!gesture_handler_)
242 gesture_handler_.reset(new InkDropGestureHandler(this)); 245 gesture_handler_.reset(new InkDropGestureHandler(this));
243 } 246 }
244 247
245 } // namespace views 248 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698