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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 298303002: Add option to install an ephemeral app to ChromeOS shelf context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed asargent's review comments Created 6 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/ash/launcher/chrome_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index fd384118f314b079470ee25146b7bd3419fb1abc..8333e8a9d2eff9ede34e979424bfe568d271c963 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -71,6 +71,7 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
@@ -579,6 +580,34 @@ bool ChromeLauncherController::IsPinnable(ash::ShelfID id) const {
CanPin());
}
+void ChromeLauncherController::Install(ash::ShelfID id) {
+ if (!HasItemController(id))
+ return;
+
+ std::string app_id = GetAppIDForShelfID(id);
+ if (extensions::util::IsExtensionInstalledPermanently(app_id, profile_))
+ return;
+
+ LauncherItemController* controller = id_to_item_controller_map_[id];
+ if (controller->type() == LauncherItemController::TYPE_APP) {
+ AppWindowLauncherItemController* app_window_controller =
+ static_cast<AppWindowLauncherItemController*>(controller);
+ app_window_controller->InstallApp();
+ }
+}
+
+bool ChromeLauncherController::CanInstall(ash::ShelfID id) {
+ int index = model_->ItemIndexByID(id);
+ if (index == -1)
+ return false;
+
+ ash::ShelfItemType type = model_->items()[index].type;
+ if (type != ash::TYPE_PLATFORM_APP)
+ return false;
+
+ return extensions::util::IsEphemeralApp(GetAppIDForShelfID(id), profile_);
+}
+
void ChromeLauncherController::LockV1AppWithID(
const std::string& app_id) {
ash::ShelfID id = GetShelfIDForAppID(app_id);

Powered by Google App Engine
This is Rietveld 408576698