Pass ImageModel to ImageView::SetImage()

The ImageSkia version of ImageView::SetImage() is deprecated.
There's no intended behavior changes with this patch.

Bug: 40137576
Change-Id: I7a9e29341c5b587fb807715d117bfe0901d2dad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6161214
Commit-Queue: SangWoo Ko <sangwoo108@chromium.org>
Reviewed-by: Jenny Zhang <jennyz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404473}
diff --git a/ash/app_list/views/app_drag_icon_proxy.cc b/ash/app_list/views/app_drag_icon_proxy.cc
index 38b0c6f10..da93b5bc 100644
--- a/ash/app_list/views/app_drag_icon_proxy.cc
+++ b/ash/app_list/views/app_drag_icon_proxy.cc
@@ -55,10 +55,10 @@
       static_cast<DragImageView*>(drag_image_widget_->GetContentsView());
 
   if (badge_icon.isNull()) {
-    drag_image->SetImage(icon);
+    drag_image->SetImage(ui::ImageModel::FromImageSkia(icon));
   } else {
-    drag_image->SetImage(
-        gfx::ImageSkiaOperations::CreateIconWithBadge(icon, badge_icon));
+    drag_image->SetImage(ui::ImageModel::FromImageSkia(
+        gfx::ImageSkiaOperations::CreateIconWithBadge(icon, badge_icon)));
   }
   gfx::Size size = drag_image->GetPreferredSize();
 
diff --git a/ash/app_list/views/app_list_item_view.cc b/ash/app_list/views/app_list_item_view.cc
index 12c95b1..5067ac9 100644
--- a/ash/app_list/views/app_list_item_view.cc
+++ b/ash/app_list/views/app_list_item_view.cc
@@ -864,12 +864,13 @@
   host_badge_icon_image_ = has_host_badge_ ? host_badge_icon : gfx::ImageSkia();
 
   if (GetColorProvider() && !host_badge_icon_image_.isNull()) {
-    icon_->SetImage(CreateBadgedShortcutImage(*app_list_config_, icon,
-                                              host_badge_icon, icon_scale_,
-                                              GetColorProvider()));
+    icon_->SetImage(ui::ImageModel::FromImageSkia(
+        CreateBadgedShortcutImage(*app_list_config_, icon, host_badge_icon,
+                                  icon_scale_, GetColorProvider())));
   } else {
-    icon_->SetImage(gfx::ImageSkiaOperations::CreateResizedImage(
-        icon, skia::ImageOperations::RESIZE_BEST, icon_size));
+    icon_->SetImage(ui::ImageModel::FromImageSkia(
+        gfx::ImageSkiaOperations::CreateResizedImage(
+            icon, skia::ImageOperations::RESIZE_BEST, icon_size)));
   }
 
   DeprecatedLayoutImmediately();
diff --git a/ash/app_list/views/assistant/assistant_dialog_plate.cc b/ash/app_list/views/assistant/assistant_dialog_plate.cc
index 51424a2..08ee9a0 100644
--- a/ash/app_list/views/assistant/assistant_dialog_plate.cc
+++ b/ash/app_list/views/assistant/assistant_dialog_plate.cc
@@ -338,8 +338,8 @@
   molecule_icon_ = AddChildView(std::make_unique<views::ImageView>());
   molecule_icon_->SetID(AssistantViewID::kModuleIcon);
   molecule_icon_->SetPreferredSize(gfx::Size(kIconSizeDip, kIconSizeDip));
-  molecule_icon_->SetImage(gfx::CreateVectorIcon(
-      chromeos::kAssistantIcon, kIconSizeDip, gfx::kPlaceholderColor));
+  molecule_icon_->SetImage(ui::ImageModel::FromVectorIcon(
+      chromeos::kAssistantIcon, gfx::kPlaceholderColor, kIconSizeDip));
 
   // Input modality layout container.
   input_modality_layout_container_ =
diff --git a/ash/app_list/views/continue_task_view.cc b/ash/app_list/views/continue_task_view.cc
index 39a33844..9deb803d 100644
--- a/ash/app_list/views/continue_task_view.cc
+++ b/ash/app_list/views/continue_task_view.cc
@@ -194,7 +194,7 @@
 
 void ContinueTaskView::UpdateIcon() {
   if (!result()) {
-    icon_->SetImage(gfx::ImageSkia());
+    icon_->SetImage(ui::ImageModel());
     return;
   }
 
@@ -210,12 +210,12 @@
     icon = result()->chip_icon();
   }
 
-  icon_->SetImage(CreateIconWithCircleBackground(
+  icon_->SetImage(ui::ImageModel::FromImageSkia(CreateIconWithCircleBackground(
       icon.size() == GetIconSize()
           ? icon
           : gfx::ImageSkiaOperations::CreateResizedImage(
                 icon, skia::ImageOperations::RESIZE_BEST, GetIconSize()),
-      GetColorProvider()->GetColor(GetIconBackgroundColorId())));
+      GetColorProvider()->GetColor(GetIconBackgroundColorId()))));
 }
 
 ui::ColorId ContinueTaskView::GetIconBackgroundColorId() const {
diff --git a/ash/app_list/views/search_result_view.cc b/ash/app_list/views/search_result_view.cc
index 3ed9c69..5c6a58b4 100644
--- a/ash/app_list/views/search_result_view.cc
+++ b/ash/app_list/views/search_result_view.cc
@@ -615,6 +615,8 @@
   rating_star_ = SetupChildImageView(title_and_details_container_);
   rating_star_->SetBorder(views::CreateEmptyBorder(
       gfx::Insets::TLBR(0, kSearchRatingStarPadding, 0, 0)));
+  rating_star_->SetImage(ui::ImageModel::FromVectorIcon(
+      kBadgeRatingIcon, kColorAshTextColorSecondary, kSearchRatingStarSize));
 
   keyboard_shortcut_container_ = body_text_container_->AddChildView(
       std::make_unique<views::FlexLayoutView>());
@@ -970,7 +972,8 @@
         gfx::ImageSkiaOperations::CreateImageWithCircleBackground(
             kSearchListHostBadgeContainerDimension / 2, background_color,
             std::move(resized_badge_icon_image));
-    badge_icon_view_->SetImage(std::move(badge_icon_with_background));
+    badge_icon_view_->SetImage(
+        ui::ImageModel::FromImageSkia(std::move(badge_icon_with_background)));
   } else {
     // Badge icon that isn't part of App Shortcuts or using background needs
     // to add shadows.
@@ -983,7 +986,8 @@
     gfx::ImageSkia badge_icon_with_shadow =
         gfx::ImageSkiaOperations::CreateImageWithDropShadow(
             std::move(resized_badge_icon_image), std::move(shadow_values));
-    badge_icon_view_->SetImage(std::move(badge_icon_with_shadow));
+    badge_icon_view_->SetImage(
+        ui::ImageModel::FromImageSkia(std::move(badge_icon_with_shadow)));
   }
 }
 
@@ -1465,9 +1469,6 @@
 void SearchResultView::OnThemeChanged() {
   views::View::OnThemeChanged();
   UpdateIconAndBadgeIcon();
-  rating_star_->SetImage(gfx::CreateVectorIcon(
-      kBadgeRatingIcon, kSearchRatingStarSize,
-      GetColorProvider()->GetColor(kColorAshTextColorSecondary)));
   SchedulePaint();
 }
 
@@ -1520,7 +1521,7 @@
   gfx::ImageSkia image(source);
   image = gfx::ImageSkiaOperations::CreateResizedImage(
       source, skia::ImageOperations::RESIZE_BEST, size);
-  icon->SetImage(image);
+  icon->SetImage(ui::ImageModel::FromImageSkia(image));
   icon->SetImageSize(size);
 }
 
diff --git a/ash/app_list/views/top_icon_animation_view.cc b/ash/app_list/views/top_icon_animation_view.cc
index 0ca34784..33026cb8 100644
--- a/ash/app_list/views/top_icon_animation_view.cc
+++ b/ash/app_list/views/top_icon_animation_view.cc
@@ -65,7 +65,7 @@
   gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(
       icon, skia::ImageOperations::RESIZE_BEST, icon_size_));
   auto icon_image = std::make_unique<views::ImageView>();
-  icon_image->SetImage(resized);
+  icon_image->SetImage(ui::ImageModel::FromImageSkia(resized));
   icon_ = AddChildView(std::move(icon_image));
   if (icon_background_ && icon_background_->layer()) {
     icon_->SetPaintToLayer();