[go: nahoru, domu]

Add quick app icon loading to quick app access model

QuickAppAccessModel holds the state of whether the quick app is
currently shown. When the quick app item has no icon loaded, the
QuickAppAccessModel observes the AppListItem and calls LoadIcon(). The
quick app model then sets the quick app state to shown once the default
icon is loaded in.

Add unittests to test loading the quick app icon, and other cases for
hiding and showing the quick app button.

Bug=b:266734005

Change-Id: Ie6003ccd522c044104674885da088a3d6d24bd6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404286
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129956}
diff --git a/ash/shelf/home_button.h b/ash/shelf/home_button.h
index 1ce809f1..2427885 100644
--- a/ash/shelf/home_button.h
+++ b/ash/shelf/home_button.h
@@ -181,6 +181,9 @@
   // Removes the nudge label from the view hierarchy.
   void RemoveNudgeLabel();
 
+  // Removes the quick app button from the view hierarchy.
+  void RemoveQuickAppButton();
+
   // views::ViewTargeterDelegate:
   bool DoesIntersectRect(const views::View* target,
                          const gfx::Rect& rect) const override;
@@ -193,7 +196,8 @@
                                     SearchModel* search_model) override;
 
   // QuickAppAccessModel::Observer:
-  void OnQuickAppChanged() override;
+  void OnQuickAppShouldShowChanged(bool quick_app_shown) override;
+  void OnQuickAppIconChanged() override;
 
   base::ScopedObservation<QuickAppAccessModel, QuickAppAccessModel::Observer>
       quick_app_model_observation_{this};
@@ -233,9 +237,6 @@
   // set by SetQuickApp().
   views::ImageButton* quick_app_button_ = nullptr;
 
-  // The app_id of the quick app button.
-  std::string quick_app_id_;
-
   base::ObserverList<NudgeAnimationObserver> observers_;
 
   base::WeakPtrFactory<HomeButton> weak_ptr_factory_{this};