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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 1422593003: Made material design ink drop QUICK_ACTION animation more visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fixes after self-review. Created 5 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/toolbar/toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 switch (event->type()) { 184 switch (event->type()) {
185 case ui::ET_GESTURE_TAP_DOWN: 185 case ui::ET_GESTURE_TAP_DOWN:
186 ink_drop_state = views::InkDropState::ACTION_PENDING; 186 ink_drop_state = views::InkDropState::ACTION_PENDING;
187 // The ui::ET_GESTURE_TAP_DOWN event needs to be marked as handled so that 187 // The ui::ET_GESTURE_TAP_DOWN event needs to be marked as handled so that
188 // subsequent events for the gesture are sent to |this|. 188 // subsequent events for the gesture are sent to |this|.
189 event->SetHandled(); 189 event->SetHandled();
190 break; 190 break;
191 case ui::ET_GESTURE_LONG_PRESS: 191 case ui::ET_GESTURE_LONG_PRESS:
192 ink_drop_state = views::InkDropState::SLOW_ACTION_PENDING; 192 ink_drop_state = views::InkDropState::SLOW_ACTION_PENDING;
193 break; 193 break;
194 case ui::ET_GESTURE_TAP:
195 ink_drop_state = views::InkDropState::QUICK_ACTION;
196 break;
197 case ui::ET_GESTURE_LONG_TAP: 194 case ui::ET_GESTURE_LONG_TAP:
198 ink_drop_state = views::InkDropState::SLOW_ACTION; 195 ink_drop_state = views::InkDropState::SLOW_ACTION;
199 break; 196 break;
197 case ui::ET_GESTURE_SCROLL_BEGIN:
200 case ui::ET_GESTURE_END: 198 case ui::ET_GESTURE_END:
201 case ui::ET_GESTURE_TAP_CANCEL:
202 ink_drop_state = views::InkDropState::HIDDEN; 199 ink_drop_state = views::InkDropState::HIDDEN;
203 break; 200 break;
204 default: 201 default:
205 return; 202 return;
206 } 203 }
204
205 views::InkDropState current_ink_drop_state =
206 ink_drop_animation_controller_->GetInkDropState();
207
208 if (ink_drop_state == views::InkDropState::HIDDEN &&
209 (current_ink_drop_state == views::InkDropState::QUICK_ACTION ||
210 current_ink_drop_state == views::InkDropState::SLOW_ACTION ||
211 current_ink_drop_state == views::InkDropState::DEACTIVATED)) {
212 // These InkDropStates automatically transition to the HIDDEN state so we
213 // don't make an explicit call. Explicitly animating to HIDDEN in this case
214 // would prematurely pre-empt these animations.
215 return;
216 }
207 ink_drop_animation_controller_->AnimateToState(ink_drop_state); 217 ink_drop_animation_controller_->AnimateToState(ink_drop_state);
208 } 218 }
209 219
210 void ToolbarButton::GetAccessibleState(ui::AXViewState* state) { 220 void ToolbarButton::GetAccessibleState(ui::AXViewState* state) {
211 CustomButton::GetAccessibleState(state); 221 CustomButton::GetAccessibleState(state);
212 state->role = ui::AX_ROLE_BUTTON_DROP_DOWN; 222 state->role = ui::AX_ROLE_BUTTON_DROP_DOWN;
213 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); 223 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS);
214 state->AddStateFlag(ui::AX_STATE_HASPOPUP); 224 state->AddStateFlag(ui::AX_STATE_HASPOPUP);
215 } 225 }
216 226
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return GetLocalBounds().CenterPoint(); 373 return GetLocalBounds().CenterPoint();
364 } 374 }
365 375
366 void ToolbarButton::UpdateInkDropHoverState() { 376 void ToolbarButton::UpdateInkDropHoverState() {
367 ink_drop_animation_controller_->SetHovered(enabled() && IsMouseHovered()); 377 ink_drop_animation_controller_->SetHovered(enabled() && IsMouseHovered());
368 } 378 }
369 379
370 const char* ToolbarButton::GetClassName() const { 380 const char* ToolbarButton::GetClassName() const {
371 return "ToolbarButton"; 381 return "ToolbarButton";
372 } 382 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.h » ('j') | ui/views/animation/ink_drop_animation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698