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

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: for owners review Created 4 years, 12 months 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 144f1e9cacebe0f1528077c29610f98de48c3a03..ecae9eb77688a44a80022b61c4b99f031eeb7bd5 100644
--- a/ash/frame/caption_buttons/frame_caption_button.h
+++ b/ash/frame/caption_buttons/frame_caption_button.h
@@ -32,18 +32,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.
@@ -64,6 +60,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;
@@ -77,25 +75,24 @@ class ASH_EXPORT FrameCaptionButton : public views::CustomButton {
// The button's current icon.
CaptionButtonIcon icon_;
+ // The size of the button's hit region.
sky 2016/01/05 00:49:16 Isn't this just the size of the button, not just t
tdanderson 2016/01/05 16:47:26 Changed the comment.
+ 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 id and image 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);

Powered by Google App Engine
This is Rietveld 408576698