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

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

Issue 2034963002: Rename InkDropHover to InkDropHighlight (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: relative patchset Created 4 years, 6 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"
11 #include "ui/events/keycodes/keyboard_codes.h" 11 #include "ui/events/keycodes/keyboard_codes.h"
12 #include "ui/gfx/animation/throb_animation.h" 12 #include "ui/gfx/animation/throb_animation.h"
13 #include "ui/gfx/color_palette.h" 13 #include "ui/gfx/color_palette.h"
14 #include "ui/native_theme/native_theme.h" 14 #include "ui/native_theme/native_theme.h"
15 #include "ui/views/animation/ink_drop_delegate.h" 15 #include "ui/views/animation/ink_drop_delegate.h"
16 #include "ui/views/animation/ink_drop_hover.h" 16 #include "ui/views/animation/ink_drop_highlight.h"
17 #include "ui/views/controls/button/blue_button.h" 17 #include "ui/views/controls/button/blue_button.h"
18 #include "ui/views/controls/button/checkbox.h" 18 #include "ui/views/controls/button/checkbox.h"
19 #include "ui/views/controls/button/image_button.h" 19 #include "ui/views/controls/button/image_button.h"
20 #include "ui/views/controls/button/label_button.h" 20 #include "ui/views/controls/button/label_button.h"
21 #include "ui/views/controls/button/menu_button.h" 21 #include "ui/views/controls/button/menu_button.h"
22 #include "ui/views/controls/button/radio_button.h" 22 #include "ui/views/controls/button/radio_button.h"
23 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
24 24
25 #if defined(USE_AURA) 25 #if defined(USE_AURA)
26 #include "ui/aura/client/capture_client.h" 26 #include "ui/aura/client/capture_client.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 } 340 }
341 341
342 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { 342 void CustomButton::VisibilityChanged(View* starting_from, bool visible) {
343 Button::VisibilityChanged(starting_from, visible); 343 Button::VisibilityChanged(starting_from, visible);
344 if (state_ == STATE_DISABLED) 344 if (state_ == STATE_DISABLED)
345 return; 345 return;
346 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); 346 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL);
347 } 347 }
348 348
349 std::unique_ptr<InkDropHover> CustomButton::CreateInkDropHover() const { 349 std::unique_ptr<InkDropHighlight> CustomButton::CreateInkDropHighlight() const {
350 return ShouldShowInkDropHover() ? Button::CreateInkDropHover() : nullptr; 350 return ShouldShowInkDropHighlight() ? Button::CreateInkDropHighlight()
351 : nullptr;
351 } 352 }
352 353
353 SkColor CustomButton::GetInkDropBaseColor() const { 354 SkColor CustomButton::GetInkDropBaseColor() const {
354 return ink_drop_base_color_; 355 return ink_drop_base_color_;
355 } 356 }
356 357
357 //////////////////////////////////////////////////////////////////////////////// 358 ////////////////////////////////////////////////////////////////////////////////
358 // CustomButton, gfx::AnimationDelegate implementation: 359 // CustomButton, gfx::AnimationDelegate implementation:
359 360
360 void CustomButton::AnimationProgressed(const gfx::Animation* animation) { 361 void CustomButton::AnimationProgressed(const gfx::Animation* animation) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 return event.type() == ui::ET_GESTURE_TAP_DOWN || 407 return event.type() == ui::ET_GESTURE_TAP_DOWN ||
407 event.type() == ui::ET_GESTURE_TAP || 408 event.type() == ui::ET_GESTURE_TAP ||
408 (event.IsMouseEvent() && 409 (event.IsMouseEvent() &&
409 (triggerable_event_flags_ & event.flags()) != 0); 410 (triggerable_event_flags_ & event.flags()) != 0);
410 } 411 }
411 412
412 bool CustomButton::ShouldEnterPushedState(const ui::Event& event) { 413 bool CustomButton::ShouldEnterPushedState(const ui::Event& event) {
413 return IsTriggerableEvent(event); 414 return IsTriggerableEvent(event);
414 } 415 }
415 416
416 bool CustomButton::ShouldShowInkDropHover() const { 417 bool CustomButton::ShouldShowInkDropHighlight() const {
417 return enabled() && !InDrag() && 418 return enabled() && !InDrag() &&
418 (IsMouseHovered() || (ShouldShowInkDropForFocus() && HasFocus())); 419 (IsMouseHovered() || (ShouldShowInkDropForFocus() && HasFocus()));
419 } 420 }
420 421
421 bool CustomButton::ShouldEnterHoveredState() { 422 bool CustomButton::ShouldEnterHoveredState() {
422 if (!visible()) 423 if (!visible())
423 return false; 424 return false;
424 425
425 bool check_mouse_position = true; 426 bool check_mouse_position = true;
426 #if defined(USE_AURA) 427 #if defined(USE_AURA)
(...skipping 24 matching lines...) Expand all
451 Button::NotifyClick(event); 452 Button::NotifyClick(event);
452 } 453 }
453 454
454 void CustomButton::OnClickCanceled(const ui::Event& event) { 455 void CustomButton::OnClickCanceled(const ui::Event& event) {
455 if (ink_drop_delegate()) 456 if (ink_drop_delegate())
456 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); 457 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
457 Button::OnClickCanceled(event); 458 Button::OnClickCanceled(event);
458 } 459 }
459 460
460 } // namespace views 461 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698