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

Unified Diff: ui/views/controls/button/image_button.cc

Issue 1534303002: CustomButton cleanup: make protected members private, create accessors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dont move declaration randomly Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/image_button.cc
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc
index d3336ee833381eafda97c0ea9057a34cbb7e26e4..ce7a545cc1f530321b032567ae91d0f1d9deab0f 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -145,11 +145,12 @@ void ImageButton::OnBlur() {
gfx::ImageSkia ImageButton::GetImageToPaint() {
gfx::ImageSkia img;
- if (!images_[STATE_HOVERED].isNull() && hover_animation_->is_animating()) {
- img = gfx::ImageSkiaOperations::CreateBlendedImage(images_[STATE_NORMAL],
- images_[STATE_HOVERED], hover_animation_->GetCurrentValue());
+ if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) {
+ img = gfx::ImageSkiaOperations::CreateBlendedImage(
+ images_[STATE_NORMAL], images_[STATE_HOVERED],
+ hover_animation().GetCurrentValue());
} else {
- img = images_[state_];
+ img = images_[state()];
}
return !img.isNull() ? img : images_[STATE_NORMAL];
@@ -212,14 +213,14 @@ void ToggleImageButton::SetToggled(bool toggled) {
NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, true);
}
-void ToggleImageButton::SetToggledImage(ButtonState state,
+void ToggleImageButton::SetToggledImage(ButtonState image_state,
const gfx::ImageSkia* image) {
if (toggled_) {
- images_[state] = image ? *image : gfx::ImageSkia();
- if (state_ == state)
+ images_[image_state] = image ? *image : gfx::ImageSkia();
+ if (state() == image_state)
SchedulePaint();
} else {
- alternate_images_[state] = image ? *image : gfx::ImageSkia();
+ alternate_images_[image_state] = image ? *image : gfx::ImageSkia();
}
}
@@ -230,19 +231,20 @@ void ToggleImageButton::SetToggledTooltipText(const base::string16& tooltip) {
////////////////////////////////////////////////////////////////////////////////
// ToggleImageButton, ImageButton overrides:
-const gfx::ImageSkia& ToggleImageButton::GetImage(ButtonState state) const {
+const gfx::ImageSkia& ToggleImageButton::GetImage(
+ ButtonState image_state) const {
if (toggled_)
- return alternate_images_[state];
- return images_[state];
+ return alternate_images_[image_state];
+ return images_[image_state];
}
-void ToggleImageButton::SetImage(ButtonState state,
+void ToggleImageButton::SetImage(ButtonState image_state,
const gfx::ImageSkia* image) {
if (toggled_) {
- alternate_images_[state] = image ? *image : gfx::ImageSkia();
+ alternate_images_[image_state] = image ? *image : gfx::ImageSkia();
} else {
- images_[state] = image ? *image : gfx::ImageSkia();
- if (state_ == state)
+ images_[image_state] = image ? *image : gfx::ImageSkia();
+ if (state() == image_state)
SchedulePaint();
}
PreferredSizeChanged();
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698