Commit 0c0ee419 authored by Sangwoo Ko's avatar Sangwoo Ko Committed by Commit Bot

Use ui::ImageModel instead of ImageSkia in App menu related classes

ui::ImageModel should be preferred to ImageSkia.
There's no intended behavior change.

Bug: 1048901, 1100034
Change-Id: I3ab2e538bb12136c74cb12db5712eb47a7b21074
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315372
Commit-Queue: Sang Woo Ko <sangwoo108@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791420}
parent e69e60b1
...@@ -121,7 +121,7 @@ AppMenuIconController::GetTypeAndSeverity() const { ...@@ -121,7 +121,7 @@ AppMenuIconController::GetTypeAndSeverity() const {
return {IconType::NONE, Severity::NONE}; return {IconType::NONE, Severity::NONE};
} }
gfx::ImageSkia AppMenuIconController::GetIconImage( ui::ImageModel AppMenuIconController::GetIconImage(
bool touch_ui, bool touch_ui,
const base::Optional<SkColor>& severity_none_color) const { const base::Optional<SkColor>& severity_none_color) const {
const gfx::VectorIcon* icon_id = const gfx::VectorIcon* icon_id =
...@@ -138,7 +138,8 @@ gfx::ImageSkia AppMenuIconController::GetIconImage( ...@@ -138,7 +138,8 @@ gfx::ImageSkia AppMenuIconController::GetIconImage(
touch_ui ? &kBrowserToolsErrorTouchIcon : &kBrowserToolsErrorIcon; touch_ui ? &kBrowserToolsErrorTouchIcon : &kBrowserToolsErrorIcon;
break; break;
} }
return gfx::CreateVectorIcon(*icon_id, GetIconColor(severity_none_color)); return ui::ImageModel::FromVectorIcon(*icon_id,
GetIconColor(severity_none_color));
} }
SkColor AppMenuIconController::GetIconColor( SkColor AppMenuIconController::GetIconColor(
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "chrome/browser/ui/global_error/global_error_service.h" #include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/upgrade_detector/upgrade_observer.h" #include "chrome/browser/upgrade_detector/upgrade_observer.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image_skia.h" #include "ui/base/models/image_model.h"
class Profile; class Profile;
class UpgradeDetector; class UpgradeDetector;
...@@ -79,7 +79,7 @@ class AppMenuIconController : public GlobalErrorObserver, ...@@ -79,7 +79,7 @@ class AppMenuIconController : public GlobalErrorObserver,
// indicates whether the touch-friendly variant is requested. // indicates whether the touch-friendly variant is requested.
// |severity_none_color|, if provided, will be used when the Severity is NONE. // |severity_none_color|, if provided, will be used when the Severity is NONE.
// Otherwise the basic toolbar button icon color will be used. // Otherwise the basic toolbar button icon color will be used.
gfx::ImageSkia GetIconImage( ui::ImageModel GetIconImage(
bool touch_ui, bool touch_ui,
const base::Optional<SkColor>& severity_none_color = base::nullopt) const; const base::Optional<SkColor>& severity_none_color = base::nullopt) const;
......
...@@ -339,8 +339,7 @@ ui::ImageModel AppMenuModel::GetIconForCommandId(int command_id) const { ...@@ -339,8 +339,7 @@ ui::ImageModel AppMenuModel::GetIconForCommandId(int command_id) const {
if (command_id == IDC_UPGRADE_DIALOG) { if (command_id == IDC_UPGRADE_DIALOG) {
DCHECK(browser_defaults::kShowUpgradeMenuItem); DCHECK(browser_defaults::kShowUpgradeMenuItem);
DCHECK(app_menu_icon_controller_); DCHECK(app_menu_icon_controller_);
return ui::ImageModel::FromImageSkia( return app_menu_icon_controller_->GetIconImage(false);
app_menu_icon_controller_->GetIconImage(false));
} }
return ui::ImageModel(); return ui::ImageModel();
} }
......
...@@ -225,13 +225,14 @@ void BrowserAppMenuButton::UpdateIcon() { ...@@ -225,13 +225,14 @@ void BrowserAppMenuButton::UpdateIcon() {
SkColor icon_color = SkColor icon_color =
toolbar_view_->app_menu_icon_controller()->GetIconColor( toolbar_view_->app_menu_icon_controller()->GetIconColor(
GetForegroundColor(state)); GetForegroundColor(state));
SetImage(state, gfx::CreateVectorIcon(icon, icon_color)); SetImageModel(state, ui::ImageModel::FromVectorIcon(icon, icon_color));
} }
return; return;
} }
for (auto state : kButtonStates) { for (auto state : kButtonStates) {
SetImage(state, toolbar_view_->app_menu_icon_controller()->GetIconImage( SetImageModel(state,
touch_ui, GetForegroundColor(state))); toolbar_view_->app_menu_icon_controller()->GetIconImage(
touch_ui, GetForegroundColor(state)));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment