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

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: 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)
bruthig 2016/07/26 13:57:15 Can you double check this logic still works well w
mohsen 2016/07/26 20:00:58 This seems to work. The activated ripple is hidden
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:
74 if (current_ink_drop_state == InkDropState::ACTIVATED) 78 if (current_ink_drop_state == InkDropState::ACTIVATED)
75 return; 79 return;
76 // Fall through to ui::ET_GESTURE_SCROLL_BEGIN case. 80 // Fall through to ui::ET_GESTURE_SCROLL_BEGIN case.
77 case ui::ET_GESTURE_SCROLL_BEGIN: 81 case ui::ET_GESTURE_SCROLL_BEGIN:
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 else 240 else
237 ink_drop_.reset(new InkDropImpl(this)); 241 ink_drop_.reset(new InkDropImpl(this));
238 242
239 if (ink_drop_mode != InkDropMode::ON) 243 if (ink_drop_mode != InkDropMode::ON)
240 gesture_handler_.reset(); 244 gesture_handler_.reset();
241 else if (!gesture_handler_) 245 else if (!gesture_handler_)
242 gesture_handler_.reset(new InkDropGestureHandler(this)); 246 gesture_handler_.reset(new InkDropGestureHandler(this));
243 } 247 }
244 248
245 } // namespace views 249 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698