Chromium Code Reviews| 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..e04dfc8ec18f489df6abc6980d4d1242f4a42ea0 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 test_package_name; |
|
Luis Héctor Chávez
2017/05/02 19:48:16
Maybe call these two |installed_package_name| and
khmel
2017/05/02 20:09:43
That is nicer.
|
| + std::string test_intent_uri; |
| + if (!value->GetAsDictionary(&app) || |
| + !app->GetBoolean(kShortcut, &shortcut) || |
| + !app->GetString(kPackageName, &test_package_name) || |
| + !app->GetString(kIntentUri, &test_intent_uri)) { |
| + VLOG(2) << "Failed to extract information for " << app_it.key() << "."; |
| + continue; |
| + } |
| + |
| + if (!shortcut || test_package_name != package_name || |
| + test_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; |