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

Side by Side Diff: ui/views/controls/button/custom_button.cc

Issue 1920783003: Fixed Back/Forward buttons to not hide ink drop when long press shows drop down menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/controls/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 void CustomButton::ShowContextMenu(const gfx::Point& p, 335 void CustomButton::ShowContextMenu(const gfx::Point& p,
336 ui::MenuSourceType source_type) { 336 ui::MenuSourceType source_type) {
337 if (!context_menu_controller()) 337 if (!context_menu_controller())
338 return; 338 return;
339 339
340 // We're about to show the context menu. Showing the context menu likely means 340 // We're about to show the context menu. Showing the context menu likely means
341 // we won't get a mouse exited and reset state. Reset it now to be sure. 341 // we won't get a mouse exited and reset state. Reset it now to be sure.
342 if (state_ != STATE_DISABLED) 342 if (state_ != STATE_DISABLED)
343 SetState(STATE_NORMAL); 343 SetState(STATE_NORMAL);
344 if (ink_drop_delegate_) { 344 if (hide_ink_drop_when_showing_context_menu_ && ink_drop_delegate_) {
345 ink_drop_delegate_->SetHovered(false); 345 ink_drop_delegate_->SetHovered(false);
346 ink_drop_delegate_->OnAction(InkDropState::HIDDEN); 346 ink_drop_delegate_->OnAction(InkDropState::HIDDEN);
347 } 347 }
348 View::ShowContextMenu(p, source_type); 348 View::ShowContextMenu(p, source_type);
349 } 349 }
350 350
351 void CustomButton::OnDragDone() { 351 void CustomButton::OnDragDone() {
352 // Only reset the state to normal if the button isn't currently disabled 352 // Only reset the state to normal if the button isn't currently disabled
353 // (since disabled buttons may still be able to be dragged). 353 // (since disabled buttons may still be able to be dragged).
354 if (state_ != STATE_DISABLED) 354 if (state_ != STATE_DISABLED)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 state_(STATE_NORMAL), 436 state_(STATE_NORMAL),
437 hover_animation_(this), 437 hover_animation_(this),
438 animate_on_state_change_(true), 438 animate_on_state_change_(true),
439 is_throbbing_(false), 439 is_throbbing_(false),
440 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON), 440 triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON),
441 request_focus_on_press_(true), 441 request_focus_on_press_(true),
442 ink_drop_delegate_(nullptr), 442 ink_drop_delegate_(nullptr),
443 notify_action_(NOTIFY_ON_RELEASE), 443 notify_action_(NOTIFY_ON_RELEASE),
444 has_ink_drop_action_on_click_(false), 444 has_ink_drop_action_on_click_(false),
445 ink_drop_action_on_click_(InkDropState::ACTION_TRIGGERED), 445 ink_drop_action_on_click_(InkDropState::ACTION_TRIGGERED),
446 hide_ink_drop_when_showing_context_menu_(true),
446 ink_drop_base_color_(gfx::kPlaceholderColor), 447 ink_drop_base_color_(gfx::kPlaceholderColor),
447 md_focus_ring_(nullptr) { 448 md_focus_ring_(nullptr) {
448 hover_animation_.SetSlideDuration(kHoverFadeDurationMs); 449 hover_animation_.SetSlideDuration(kHoverFadeDurationMs);
449 } 450 }
450 451
451 void CustomButton::StateChanged() { 452 void CustomButton::StateChanged() {
452 } 453 }
453 454
454 bool CustomButton::IsTriggerableEvent(const ui::Event& event) { 455 bool CustomButton::IsTriggerableEvent(const ui::Event& event) {
455 return event.type() == ui::ET_GESTURE_TAP_DOWN || 456 return event.type() == ui::ET_GESTURE_TAP_DOWN ||
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 Button::NotifyClick(event); 508 Button::NotifyClick(event);
508 } 509 }
509 510
510 void CustomButton::OnClickCanceled(const ui::Event& event) { 511 void CustomButton::OnClickCanceled(const ui::Event& event) {
511 if (ink_drop_delegate()) 512 if (ink_drop_delegate())
512 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); 513 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
513 Button::OnClickCanceled(event); 514 Button::OnClickCanceled(event);
514 } 515 }
515 516
516 } // namespace views 517 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698