Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5478)

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc

Issue 2520173002: arc: Fix duplicate icons in app launcher in case of crash. (Closed)
Patch Set: nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e1248f520f039ce9daf645722fc84a6b6ab04d10..e2e59da6a19e65862a30eb76f81be6b0ae94da29 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
@@ -248,6 +248,9 @@ ArcAppListPrefs::ArcAppListPrefs(
DCHECK(arc::ArcSessionManager::IsAllowedForProfile(profile));
+ const std::vector<std::string> existing_app_ids = GetAppIds();
+ tracked_apps_.insert(existing_app_ids.begin(), existing_app_ids.end());
+
// Once default apps are ready OnDefaultAppsReady is called.
}
@@ -569,10 +572,9 @@ void ArcAppListPrefs::NotifyRegisteredApps() {
}
// Default apps are reported earlier.
- if (!tracked_apps_.count(app_id)) {
+ if (tracked_apps_.insert(app_id).second) {
for (auto& observer : observer_list_)
observer.OnAppRegistered(app_id, *app_info);
- tracked_apps_.insert(app_id);
}
}
@@ -667,8 +669,8 @@ void ArcAppListPrefs::OnInstanceReady() {
arc::mojom::AppInstance* app_instance =
app_instance_holder_->GetInstanceForMethod("RefreshAppList");
+ // Note, sync_service_ may be nullptr in testing.
sync_service_ = arc::ArcPackageSyncableService::Get(profile_);
- DCHECK(sync_service_);
// Kiosk apps should be run only for kiosk sessions.
if (user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp()) {
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/arc/arc_app_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698