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

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

Issue 2858703002: arc: Support UNINSTALL_SHORTCUT (Closed)
Patch Set: typo fix Created 3 years, 8 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 0c2e812e905712e7e34a4ad15360222534e0e39b..5f4500f8de2c99f9cfb5eea53dbe999aa5af9b18 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
@@ -1085,6 +1085,37 @@ void ArcAppListPrefs::OnInstallShortcut(arc::mojom::ShortcutInfoPtr shortcut) {
arc::mojom::OrientationLock::NONE);
}
+void ArcAppListPrefs::OnUninstallShortcut(const std::string& package_name,
+ const std::string& intent_uri) {
+ std::vector<std::string> shortcuts_to_remove;
+ const base::DictionaryValue* apps = prefs_->GetDictionary(prefs::kArcApps);
+ for (base::DictionaryValue::Iterator app_it(*apps); !app_it.IsAtEnd();
+ app_it.Advance()) {
+ const base::Value* value = &app_it.value();
+ const base::DictionaryValue* app;
+ bool shortcut;
+ std::string installed_package_name;
+ std::string installed_intent_uri;
+ if (!value->GetAsDictionary(&app) ||
+ !app->GetBoolean(kShortcut, &shortcut) ||
+ !app->GetString(kPackageName, &installed_package_name) ||
+ !app->GetString(kIntentUri, &installed_intent_uri)) {
+ VLOG(2) << "Failed to extract information for " << app_it.key() << ".";
+ continue;
+ }
+
+ if (!shortcut || installed_package_name != package_name ||
+ installed_intent_uri != intent_uri) {
+ continue;
+ }
+
+ shortcuts_to_remove.push_back(app_it.key());
+ }
+
+ for (const auto& shortcut_id : shortcuts_to_remove)
+ RemoveApp(shortcut_id);
+}
+
std::unordered_set<std::string> ArcAppListPrefs::GetAppsForPackage(
const std::string& package_name) const {
std::unordered_set<std::string> app_set;
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_list_prefs.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698