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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 GetInkDropBaseColor(), ink_drop_visible_opacity())); | 451 GetInkDropBaseColor(), ink_drop_visible_opacity())); |
452 } | 452 } |
453 | 453 |
454 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() | 454 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() |
455 const { | 455 const { |
456 if (!ShouldShowInkDropHighlight()) | 456 if (!ShouldShowInkDropHighlight()) |
457 return nullptr; | 457 return nullptr; |
458 return GetText().empty() | 458 return GetText().empty() |
459 ? CreateDefaultInkDropHighlight( | 459 ? CreateDefaultInkDropHighlight( |
460 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) | 460 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()) |
461 : base::WrapUnique(new views::InkDropHighlight( | 461 : base::MakeUnique<views::InkDropHighlight>( |
462 size(), kInkDropSmallCornerRadius, | 462 size(), kInkDropSmallCornerRadius, |
463 gfx::RectF(GetLocalBounds()).CenterPoint(), | 463 gfx::RectF(GetLocalBounds()).CenterPoint(), |
464 GetInkDropBaseColor())); | 464 GetInkDropBaseColor()); |
465 } | 465 } |
466 | 466 |
467 void LabelButton::StateChanged() { | 467 void LabelButton::StateChanged() { |
468 const gfx::Size previous_image_size(image_->GetPreferredSize()); | 468 const gfx::Size previous_image_size(image_->GetPreferredSize()); |
469 UpdateImage(); | 469 UpdateImage(); |
470 ResetLabelEnabledColor(); | 470 ResetLabelEnabledColor(); |
471 label_->SetEnabled(state() != STATE_DISABLED); | 471 label_->SetEnabled(state() != STATE_DISABLED); |
472 if (image_->GetPreferredSize() != previous_image_size) | 472 if (image_->GetPreferredSize() != previous_image_size) |
473 Layout(); | 473 Layout(); |
474 } | 474 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 void LabelButton::ResetLabelEnabledColor() { | 606 void LabelButton::ResetLabelEnabledColor() { |
607 const SkColor color = | 607 const SkColor color = |
608 explicitly_set_colors_[state()] | 608 explicitly_set_colors_[state()] |
609 ? button_state_colors_[state()] | 609 ? button_state_colors_[state()] |
610 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 610 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
611 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 611 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
612 label_->SetEnabledColor(color); | 612 label_->SetEnabledColor(color); |
613 } | 613 } |
614 | 614 |
615 } // namespace views | 615 } // namespace views |
OLD | NEW |