Skip to content

Commit

Permalink
Infobar MD refresh: close button.
Browse files Browse the repository at this point in the history
For now, like the find bar, there is no hover or pressed state (see crbug.com/523356)

BUG=520266
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/1322583006

Cr-Commit-Position: refs/heads/master@{#347769}
  • Loading branch information
estade authored and Commit bot committed Sep 8, 2015
1 parent 85d35ae commit fba7202
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/find_bar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ void FindBarView::InitViewsForMaterial() {
} button_images[] = {
{find_previous_button_, gfx::VectorIconId::FIND_PREV},
{find_next_button_, gfx::VectorIconId::FIND_NEXT},
{close_button_, gfx::VectorIconId::FIND_CLOSE},
{close_button_, gfx::VectorIconId::BAR_CLOSE},
};

SkColor grey;
Expand Down
28 changes: 21 additions & 7 deletions chrome/browser/ui/views/infobars/infobar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "ui/compositor/clip_transform_recorder.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icons_public.h"
#include "ui/native_theme/common_theme.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h"
Expand Down Expand Up @@ -218,13 +222,23 @@ void InfoBarView::ViewHierarchyChanged(
}

close_button_ = new views::ImageButton(this);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::STATE_NORMAL,
rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia());
close_button_->SetImage(views::CustomButton::STATE_HOVERED,
rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia());
close_button_->SetImage(views::CustomButton::STATE_PRESSED,
rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia());

if (ui::MaterialDesignController::IsModeMaterial()) {
SkColor grey;
ui::CommonThemeGetSystemColor(ui::NativeTheme::kColorId_ChromeIconGrey,
&grey);
gfx::ImageSkia image =
gfx::CreateVectorIcon(gfx::VectorIconId::BAR_CLOSE, 16, grey);
close_button_->SetImage(views::CustomButton::STATE_NORMAL, &image);
} else {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::STATE_NORMAL,
rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia());
close_button_->SetImage(views::CustomButton::STATE_HOVERED,
rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia());
close_button_->SetImage(views::CustomButton::STATE_PRESSED,
rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia());
}
close_button_->SizeToPreferredSize();
close_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
Expand Down
4 changes: 2 additions & 2 deletions ui/gfx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ action("aggregate_vector_icons") {
"vector_icons/account_child_invert.icon",
"vector_icons/apps.icon",
"vector_icons/autofill.icon",
"vector_icons/bar_close.1x.icon",
"vector_icons/bar_close.icon",
"vector_icons/blocked_badge.icon",
"vector_icons/check_circle.icon",
"vector_icons/code.icon",
"vector_icons/cookie.icon",
"vector_icons/extension.icon",
"vector_icons/file_download.icon",
"vector_icons/file_download_shelf.icon",
"vector_icons/find_close.1x.icon",
"vector_icons/find_close.icon",
"vector_icons/find_next.1x.icon",
"vector_icons/find_next.icon",
"vector_icons/find_prev.1x.icon",
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit fba7202

Please sign in to comment.