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

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

Issue 1756193008: Support uninstalling ARC app from Chrome launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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_context_menu.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_context_menu.cc b/chrome/browser/ui/app_list/arc/arc_app_context_menu.cc
index 08fdea000bf872f3d495f98640cb37f4b7221df5..78f745661e2ddb914f5444709954ed4dd8238c0e 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_context_menu.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_context_menu.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
+#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/grit/generated_resources.h"
ArcAppContextMenu::ArcAppContextMenu(
@@ -26,6 +27,12 @@ void ArcAppContextMenu::BuildMenu(ui::SimpleMenuModel* menu_model) {
menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
// Create default items.
AppContextMenu::BuildMenu(menu_model);
+ if (!isUninstallable()) {
+ menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
khmel 2016/03/04 18:35:53 Did you pass unit_tests? They should be updated as
victorhsieh0 2016/03/07 21:00:15 Done. Test added.
+ menu_model->AddItemWithStringId(
+ UNINSTALL,
+ IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON);
khmel 2016/03/04 18:35:53 Probably we need dedicated message for this, not e
victorhsieh0 2016/03/07 21:00:15 IDS_APP_LIST_UNINSTALL_ITEM looks like the one for
+ }
}
bool ArcAppContextMenu::IsCommandIdEnabled(int command_id) const {
@@ -38,8 +45,24 @@ bool ArcAppContextMenu::IsCommandIdEnabled(int command_id) const {
}
void ArcAppContextMenu::ExecuteCommand(int command_id, int event_flags) {
- if (command_id == LAUNCH_NEW)
+ if (command_id == LAUNCH_NEW) {
Luis Héctor Chávez 2016/03/04 21:29:37 nit: Probably a switch is better now.
victorhsieh0 2016/03/07 21:00:15 Done.
delegate()->ExecuteLaunchCommand(event_flags);
- else
+ } else if (command_id == UNINSTALL) {
+ UninstallApp();
+ } else {
AppContextMenu::ExecuteCommand(command_id, event_flags);
+ }
+}
+
+void ArcAppContextMenu::UninstallApp() {
+ ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile());
khmel 2016/03/04 18:35:53 Put this log to arc_app_utils
victorhsieh0 2016/03/07 21:00:15 Done.
+ scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id());
+ VLOG(2) << "Uninstalling " << app_info->package_name;
+ arc::UninstallApp(profile(), app_info->package_name);
+}
+
+bool ArcAppContextMenu::isUninstallable() const {
+ ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile());
+ scoped_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp(app_id());
+ return app_info && app_info->uninstallable;
khmel 2016/03/04 18:35:53 I think app mast be ready too to be able to unista
victorhsieh0 2016/03/07 21:00:15 Done.
}

Powered by Google App Engine
This is Rietveld 408576698