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

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

Issue 1566563002: Vectorize CrOS window control icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dummy GetIcon impl in TestToolbarModel Created 4 years, 11 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.cc
diff --git a/ash/frame/caption_buttons/frame_caption_button.cc b/ash/frame/caption_buttons/frame_caption_button.cc
index 042201c26dc085b3f19f0137b319ea4abfef3d76..300e2ba22d782ff2e941fedff9794e2dc9691f76 100644
--- a/ash/frame/caption_buttons/frame_caption_button.cc
+++ b/ash/frame/caption_buttons/frame_caption_button.cc
@@ -4,10 +4,12 @@
#include "ash/frame/caption_buttons/frame_caption_button.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/color_palette.h"
+#include "ui/gfx/paint_vector_icon.h"
+#include "ui/gfx/vector_icons_public.h"
namespace ash {
@@ -40,8 +42,9 @@ FrameCaptionButton::FrameCaptionButton(views::ButtonListener* listener,
: CustomButton(listener),
icon_(icon),
paint_as_active_(false),
+ use_light_images_(false),
alpha_(255),
- icon_image_id_(-1),
+ icon_image_id_(gfx::VectorIconId::VECTOR_ICON_NONE),
swap_images_animation_(new gfx::SlideAnimation(this)) {
swap_images_animation_->Reset(1);
@@ -55,8 +58,8 @@ FrameCaptionButton::~FrameCaptionButton() {
void FrameCaptionButton::SetImage(CaptionButtonIcon icon,
Animate animate,
- int icon_image_id) {
- // The early return is dependant on |animate| because callers use SetImage()
+ gfx::VectorIconId icon_image_id) {
+ // The early return is dependent on |animate| because callers use SetImage()
// with ANIMATE_NO to progress the crossfade animation to the end.
if (icon == icon_ &&
(animate == ANIMATE_YES || !swap_images_animation_->is_animating()) &&
@@ -69,9 +72,9 @@ void FrameCaptionButton::SetImage(CaptionButtonIcon icon,
icon_ = icon;
icon_image_id_ = icon_image_id;
-
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- icon_image_ = *rb.GetImageSkiaNamed(icon_image_id);
+ icon_image_ = gfx::CreateVectorIcon(
+ icon_image_id, 12,
+ use_light_images_ ? SK_ColorWHITE : gfx::kChromeIconGrey);
if (animate == ANIMATE_YES) {
swap_images_animation_->Reset(0);
« no previous file with comments | « ash/frame/caption_buttons/frame_caption_button.h ('k') | ash/frame/caption_buttons/frame_caption_button_container_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698