| OLD | NEW |
| 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 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 441 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 442 image()->SetPaintToLayer(false); | 442 image()->SetPaintToLayer(false); |
| 443 ink_drop_container_->layer()->Remove(ink_drop_layer); | 443 ink_drop_container_->layer()->Remove(ink_drop_layer); |
| 444 ink_drop_container_->SetVisible(false); | 444 ink_drop_container_->SetVisible(false); |
| 445 } | 445 } |
| 446 | 446 |
| 447 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { | 447 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { |
| 448 return GetText().empty() | 448 return GetText().empty() |
| 449 ? CreateDefaultInkDropRipple( | 449 ? CreateDefaultInkDropRipple( |
| 450 image()->GetMirroredBounds().CenterPoint()) | 450 image()->GetMirroredBounds().CenterPoint()) |
| 451 : std::unique_ptr<views::InkDropRipple>( | 451 : base::MakeUnique<views::FloodFillInkDropRipple>( |
| 452 new views::FloodFillInkDropRipple( | 452 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), |
| 453 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), | 453 GetInkDropBaseColor(), ink_drop_visible_opacity()); |
| 454 GetInkDropBaseColor(), ink_drop_visible_opacity())); | |
| 455 } | 454 } |
| 456 | 455 |
| 457 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() | 456 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() |
| 458 const { | 457 const { |
| 459 if (!ShouldShowInkDropHighlight()) | 458 if (!ShouldShowInkDropHighlight()) |
| 460 return nullptr; | 459 return nullptr; |
| 461 return GetText().empty() | 460 return GetText().empty() |
| 462 ? CreateDefaultInkDropHighlight( | 461 ? CreateDefaultInkDropHighlight( |
| 463 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) | 462 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) |
| 464 : base::MakeUnique<views::InkDropHighlight>( | 463 : base::MakeUnique<views::InkDropHighlight>( |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 void LabelButton::ResetLabelEnabledColor() { | 608 void LabelButton::ResetLabelEnabledColor() { |
| 610 const SkColor color = | 609 const SkColor color = |
| 611 explicitly_set_colors_[state()] | 610 explicitly_set_colors_[state()] |
| 612 ? button_state_colors_[state()] | 611 ? button_state_colors_[state()] |
| 613 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 612 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 614 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 613 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 615 label_->SetEnabledColor(color); | 614 label_->SetEnabledColor(color); |
| 616 } | 615 } |
| 617 | 616 |
| 618 } // namespace views | 617 } // namespace views |
| OLD | NEW |