Index: chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
index 7a5f456ffc98a150b05541e4c90e5fd55e944951..9726cc466b500bb7e0a7543cdcfc8e8c57c23a8f 100644 |
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
@@ -317,6 +317,23 @@ base::FilePath ArcAppListPrefs::GetIconPath( |
return ToIconPath(GetAppPath(app_id), scale_factor); |
} |
+bool ArcAppListPrefs::IsIconRequestRecorded( |
+ const std::string& app_id, |
+ ui::ScaleFactor scale_factor) const { |
+ const auto iter = request_icon_record_.find(app_id); |
+ if (iter == request_icon_record_.end()) |
+ return false; |
+ return iter->second & 1 << scale_factor; |
+} |
+ |
+void ArcAppListPrefs::MaybeRemoveIconRequestRecord(const std::string& app_id) { |
+ request_icon_record_.erase(app_id); |
+} |
+ |
+void ArcAppListPrefs::ClearIconRequestRecord() { |
+ request_icon_record_.clear(); |
+} |
+ |
void ArcAppListPrefs::RequestIcon(const std::string& app_id, |
ui::ScaleFactor scale_factor) { |
// ArcSessionManager can be terminated during test tear down, before callback |
@@ -349,6 +366,11 @@ void ArcAppListPrefs::RequestIcon(const std::string& app_id, |
return; |
} |
+ // This record will prevent ArcAppIcon from resending request to Android for |
+ // AppIcon when icon file decode failure is sufferd. |
+ request_icon_record_[app_id] = |
+ request_icon_record_[app_id] | 1 << scale_factor; |
+ |
if (app_info->icon_resource_id.empty()) { |
auto* app_instance = |
ARC_GET_INSTANCE_FOR_METHOD(app_instance_holder_, RequestAppIcon); |
@@ -739,6 +761,7 @@ void ArcAppListPrefs::OnInstanceClosed() { |
default_apps_installations_.clear(); |
detect_default_app_availability_timeout_.Stop(); |
binding_.Close(); |
+ ClearIconRequestRecord(); |
if (sync_service_) { |
sync_service_->StopSyncing(syncer::ARC_PACKAGE); |
@@ -862,6 +885,8 @@ void ArcAppListPrefs::RemoveApp(const std::string& app_id) { |
arc::RemoveCachedIcon(app_info->icon_resource_id); |
} |
+ MaybeRemoveIconRequestRecord(app_id); |
+ |
// From now, app is not available. |
ready_apps_.erase(app_id); |