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

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

Issue 2034963002: Rename InkDropHover to InkDropHighlight (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gyp file 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
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/base/material_design/material_design_controller.h" 15 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/gfx/animation/throb_animation.h" 16 #include "ui/gfx/animation/throb_animation.h"
17 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/color_utils.h" 18 #include "ui/gfx/color_utils.h"
19 #include "ui/gfx/font_list.h" 19 #include "ui/gfx/font_list.h"
20 #include "ui/gfx/geometry/vector2d.h" 20 #include "ui/gfx/geometry/vector2d.h"
21 #include "ui/native_theme/native_theme.h" 21 #include "ui/native_theme/native_theme.h"
22 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 22 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
23 #include "ui/views/animation/ink_drop_hover.h" 23 #include "ui/views/animation/ink_drop_highlight.h"
24 #include "ui/views/background.h" 24 #include "ui/views/background.h"
25 #include "ui/views/controls/button/label_button_border.h" 25 #include "ui/views/controls/button/label_button_border.h"
26 #include "ui/views/painter.h" 26 #include "ui/views/painter.h"
27 #include "ui/views/style/platform_style.h" 27 #include "ui/views/style/platform_style.h"
28 #include "ui/views/window/dialog_delegate.h" 28 #include "ui/views/window/dialog_delegate.h"
29 29
30 namespace { 30 namespace {
31 31
32 // The default spacing between the icon and text. 32 // The default spacing between the icon and text.
33 const int kSpacing = 5; 33 const int kSpacing = 5;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 ink_drop_container_->SetVisible(false); 438 ink_drop_container_->SetVisible(false);
439 } 439 }
440 440
441 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { 441 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const {
442 return GetText().empty() ? CustomButton::CreateInkDropRipple() 442 return GetText().empty() ? CustomButton::CreateInkDropRipple()
443 : base::WrapUnique(new views::FloodFillInkDropRipple( 443 : base::WrapUnique(new views::FloodFillInkDropRipple(
444 GetLocalBounds(), GetInkDropCenter(), 444 GetLocalBounds(), GetInkDropCenter(),
445 GetInkDropBaseColor())); 445 GetInkDropBaseColor()));
446 } 446 }
447 447
448 std::unique_ptr<views::InkDropHover> LabelButton::CreateInkDropHover() const { 448 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight()
449 if (!ShouldShowInkDropHover()) 449 const {
450 if (!ShouldShowInkDropHighlight())
450 return nullptr; 451 return nullptr;
451 return GetText().empty() ? CustomButton::CreateInkDropHover() 452 return GetText().empty() ? CustomButton::CreateInkDropHighlight()
452 : base::WrapUnique(new views::InkDropHover( 453 : base::WrapUnique(new views::InkDropHighlight(
453 size(), kInkDropSmallCornerRadius, 454 size(), kInkDropSmallCornerRadius,
454 GetInkDropCenter(), GetInkDropBaseColor())); 455 GetInkDropCenter(), GetInkDropBaseColor()));
455 } 456 }
456 457
457 gfx::Point LabelButton::GetInkDropCenter() const { 458 gfx::Point LabelButton::GetInkDropCenter() const {
458 // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent 459 // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent
459 // that triggered them. 460 // that triggered them.
460 return GetText().empty() ? image()->GetMirroredBounds().CenterPoint() 461 return GetText().empty() ? image()->GetMirroredBounds().CenterPoint()
461 : CustomButton::GetInkDropCenter(); 462 : CustomButton::GetInkDropCenter();
462 } 463 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 void LabelButton::ResetLabelEnabledColor() { 590 void LabelButton::ResetLabelEnabledColor() {
590 const SkColor color = 591 const SkColor color =
591 explicitly_set_colors_[state()] 592 explicitly_set_colors_[state()]
592 ? button_state_colors_[state()] 593 ? button_state_colors_[state()]
593 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 594 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
594 if (state() != STATE_DISABLED && label_->enabled_color() != color) 595 if (state() != STATE_DISABLED && label_->enabled_color() != color)
595 label_->SetEnabledColor(color); 596 label_->SetEnabledColor(color);
596 } 597 }
597 598
598 } // namespace views 599 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698