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

Unified Diff: ash/frame/caption_buttons/frame_caption_button.h

Issue 1505223004: Do not use assets for Ash window control button backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP for pkasting and estade feedback 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
Index: ash/frame/caption_buttons/frame_caption_button.h
diff --git a/ash/frame/caption_buttons/frame_caption_button.h b/ash/frame/caption_buttons/frame_caption_button.h
index a54461d4eaad90f742b24c7b8091eee4fc378adb..c6f1b2933fb9f5bca24f95f81de5cf97a3a6a8c6 100644
--- a/ash/frame/caption_buttons/frame_caption_button.h
+++ b/ash/frame/caption_buttons/frame_caption_button.h
@@ -31,18 +31,14 @@ class ASH_EXPORT FrameCaptionButton : public views::CustomButton {
FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon);
~FrameCaptionButton() override;
- // Sets the images to use to paint the button. If |animate| is ANIMATE_YES,
- // the button crossfades to the new visuals. If the image ids match those
- // currently used by the button and |animate| is ANIMATE_NO the crossfade
+ // Sets the image to use to paint the button. If |animate| is ANIMATE_YES,
+ // the button crossfades to the new visuals. If the image id matches the one
+ // currently used by the button and |animate| is ANIMATE_NO, the crossfade
// animation is progressed to the end.
- void SetImages(CaptionButtonIcon icon,
- Animate animate,
- int icon_image_id,
- int hovered_background_image_id,
- int pressed_background_image_id);
+ void SetImage(CaptionButtonIcon icon, Animate animate, int icon_image_id);
// Returns true if the button is crossfading to new visuals set in
- // SetImages().
+ // SetImage().
bool IsAnimatingImageSwap() const;
// Sets the alpha to use for painting. Used to animate visibility changes.
@@ -63,6 +59,8 @@ class ASH_EXPORT FrameCaptionButton : public views::CustomButton {
int icon_image_id() const { return icon_image_id_; }
+ void set_size(const gfx::Size& size) { size_ = size; }
+
protected:
// views::CustomButton override:
void OnGestureEvent(ui::GestureEvent* event) override;
@@ -76,25 +74,24 @@ class ASH_EXPORT FrameCaptionButton : public views::CustomButton {
// The button's current icon.
CaptionButtonIcon icon_;
+ // The size of the button's hit region.
+ gfx::Size size_;
+
// Whether the button should be painted as active.
bool paint_as_active_;
// Current alpha to use for painting.
int alpha_;
- // The images and image ids used to paint the button.
+ // The image and image id used to paint the button's icon.
int icon_image_id_;
- int hovered_background_image_id_;
- int pressed_background_image_id_;
gfx::ImageSkia icon_image_;
- gfx::ImageSkia hovered_background_image_;
- gfx::ImageSkia pressed_background_image_;
// The icon image to crossfade from.
gfx::ImageSkia crossfade_icon_image_;
// Crossfade animation started when the button's images are changed by
- // SetImages().
+ // SetImage().
scoped_ptr<gfx::SlideAnimation> swap_images_animation_;
DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton);
« no previous file with comments | « no previous file | ash/frame/caption_buttons/frame_caption_button.cc » ('j') | ash/frame/caption_buttons/frame_caption_button.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698