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

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

Issue 2860243002: arc: Fix removing shortcuts on package update. (Closed)
Patch Set: Created 3 years, 7 months 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
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 b8fcc2b66b5750ece397b5322d4bae6242b019ef..dbc585e024a3a5c7c42b0c47d500aa16a7604f98 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
@@ -1118,6 +1118,13 @@ void ArcAppListPrefs::OnUninstallShortcut(const std::string& package_name,
std::unordered_set<std::string> ArcAppListPrefs::GetAppsForPackage(
const std::string& package_name) const {
+ return GetAppsAndShortcutsForPackage(package_name,
+ false /* include_shortcuts */);
+}
+
+std::unordered_set<std::string> ArcAppListPrefs::GetAppsAndShortcutsForPackage(
+ const std::string& package_name,
+ bool include_shortcuts) const {
std::unordered_set<std::string> app_set;
const base::DictionaryValue* apps = prefs_->GetDictionary(prefs::kArcApps);
for (base::DictionaryValue::Iterator app_it(*apps); !app_it.IsAtEnd();
@@ -1138,6 +1145,12 @@ std::unordered_set<std::string> ArcAppListPrefs::GetAppsForPackage(
if (package_name != app_package)
continue;
+ if (!include_shortcuts) {
+ bool shortcut = false;
+ if (app->GetBoolean(kShortcut, &shortcut) && shortcut)
+ continue;
+ }
+
app_set.insert(app_it.key());
}
@@ -1146,7 +1159,7 @@ std::unordered_set<std::string> ArcAppListPrefs::GetAppsForPackage(
void ArcAppListPrefs::HandlePackageRemoved(const std::string& package_name) {
const std::unordered_set<std::string> apps_to_remove =
- GetAppsForPackage(package_name);
+ GetAppsAndShortcutsForPackage(package_name, true /* include_shortcuts */);
for (const auto& app_id : apps_to_remove)
RemoveApp(app_id);

Powered by Google App Engine
This is Rietveld 408576698