Chromium Code Reviews| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 438 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 439 image()->SetPaintToLayer(false); | 439 image()->SetPaintToLayer(false); |
| 440 ink_drop_container_->layer()->Remove(ink_drop_layer); | 440 ink_drop_container_->layer()->Remove(ink_drop_layer); |
| 441 ink_drop_container_->SetVisible(false); | 441 ink_drop_container_->SetVisible(false); |
| 442 } | 442 } |
| 443 | 443 |
| 444 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { | 444 std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const { |
| 445 return GetText().empty() | 445 return GetText().empty() |
| 446 ? CreateDefaultInkDropRipple( | 446 ? CreateDefaultInkDropRipple( |
| 447 image()->GetMirroredBounds().CenterPoint()) | 447 image()->GetMirroredBounds().CenterPoint()) |
| 448 : std::unique_ptr<views::InkDropRipple>( | 448 : base::WrapUnique(new views::FloodFillInkDropRipple( |
|
bruthig
2016/08/25 17:45:29
I believe the convention is to use MakeUnique().
Evan Stade
2016/08/26 23:36:15
Done.
| |
| 449 new views::FloodFillInkDropRipple( | 449 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), |
| 450 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), | 450 GetInkDropBaseColor(), ink_drop_visible_opacity())); |
| 451 GetInkDropBaseColor(), ink_drop_visible_opacity())); | |
| 452 } | 451 } |
| 453 | 452 |
| 454 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() | 453 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() |
| 455 const { | 454 const { |
| 456 if (!ShouldShowInkDropHighlight()) | 455 if (!ShouldShowInkDropHighlight()) |
| 457 return nullptr; | 456 return nullptr; |
| 458 return GetText().empty() | 457 return GetText().empty() |
| 459 ? CreateDefaultInkDropHighlight( | 458 ? CreateDefaultInkDropHighlight( |
| 460 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) | 459 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) |
| 461 : base::WrapUnique(new views::InkDropHighlight( | 460 : base::WrapUnique(new views::InkDropHighlight( |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 void LabelButton::ResetLabelEnabledColor() { | 605 void LabelButton::ResetLabelEnabledColor() { |
| 607 const SkColor color = | 606 const SkColor color = |
| 608 explicitly_set_colors_[state()] | 607 explicitly_set_colors_[state()] |
| 609 ? button_state_colors_[state()] | 608 ? button_state_colors_[state()] |
| 610 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 609 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 611 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 610 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 612 label_->SetEnabledColor(color); | 611 label_->SetEnabledColor(color); |
| 613 } | 612 } |
| 614 | 613 |
| 615 } // namespace views | 614 } // namespace views |
| OLD | NEW |