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

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

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master. Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/button_ink_drop_delegate.h" 5 #include "ui/views/animation/button_ink_drop_delegate.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/views/animation/ink_drop_animation_controller.h" 9 #include "ui/views/animation/ink_drop_animation_controller.h"
10 #include "ui/views/animation/ink_drop_animation_controller_factory.h" 10 #include "ui/views/animation/ink_drop_animation_controller_factory.h"
(...skipping 25 matching lines...) Expand all
36 36
37 void ButtonInkDropDelegate::OnLayout() { 37 void ButtonInkDropDelegate::OnLayout() {
38 ink_drop_animation_controller_->SetInkDropCenter( 38 ink_drop_animation_controller_->SetInkDropCenter(
39 ink_drop_host_->CalculateInkDropCenter()); 39 ink_drop_host_->CalculateInkDropCenter());
40 } 40 }
41 41
42 void ButtonInkDropDelegate::OnAction(InkDropState state) { 42 void ButtonInkDropDelegate::OnAction(InkDropState state) {
43 ink_drop_animation_controller_->AnimateToState(state); 43 ink_drop_animation_controller_->AnimateToState(state);
44 } 44 }
45 45
46 void ButtonInkDropDelegate::SetHovered(bool is_hovered) {
47 ink_drop_animation_controller_->SetHovered(is_hovered);
48 }
49
46 //////////////////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////////////////
47 // ui::EventHandler: 51 // ui::EventHandler:
48 52
49 void ButtonInkDropDelegate::OnGestureEvent(ui::GestureEvent* event) { 53 void ButtonInkDropDelegate::OnGestureEvent(ui::GestureEvent* event) {
50 InkDropState current_ink_drop_state = 54 InkDropState current_ink_drop_state =
51 ink_drop_animation_controller_->GetInkDropState(); 55 ink_drop_animation_controller_->GetInkDropState();
52 56
53 InkDropState ink_drop_state = InkDropState::HIDDEN; 57 InkDropState ink_drop_state = InkDropState::HIDDEN;
54 switch (event->type()) { 58 switch (event->type()) {
55 case ui::ET_GESTURE_TAP_DOWN: 59 case ui::ET_GESTURE_TAP_DOWN:
(...skipping 25 matching lines...) Expand all
81 current_ink_drop_state == InkDropState::DEACTIVATED)) { 85 current_ink_drop_state == InkDropState::DEACTIVATED)) {
82 // These InkDropStates automatically transition to the HIDDEN state so we 86 // These InkDropStates automatically transition to the HIDDEN state so we
83 // don't make an explicit call. Explicitly animating to HIDDEN in this case 87 // don't make an explicit call. Explicitly animating to HIDDEN in this case
84 // would prematurely pre-empt these animations. 88 // would prematurely pre-empt these animations.
85 return; 89 return;
86 } 90 }
87 ink_drop_animation_controller_->AnimateToState(ink_drop_state); 91 ink_drop_animation_controller_->AnimateToState(ink_drop_state);
88 } 92 }
89 93
90 } // namespace views 94 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698