Index: apps/launcher.cc |
diff --git a/apps/launcher.cc b/apps/launcher.cc |
index aae298f10454c08e4ac94887267d58411facefbe..384d2717c5b1be776b889fa66cd5ed94ce6b0f73 100644 |
--- a/apps/launcher.cc |
+++ b/apps/launcher.cc |
@@ -26,6 +26,7 @@ |
#include "chrome/common/extensions/api/app_runtime.h" |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/extensions/extension_messages.h" |
+#include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/web_contents.h" |
@@ -37,6 +38,7 @@ |
#include "chrome/browser/chromeos/drive/file_errors.h" |
#include "chrome/browser/chromeos/drive/file_system_interface.h" |
#include "chrome/browser/chromeos/drive/file_system_util.h" |
+#include "chrome/browser/chromeos/login/user_manager.h" |
#endif |
#if defined(OS_WIN) |
@@ -313,15 +315,32 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, |
const CommandLine* command_line, |
const base::FilePath& current_directory) { |
#if defined(OS_WIN) |
- // On Windows 8's single window Metro mode we can not launch platform apps. |
- // Offer to switch Chrome to desktop mode. |
- if (win8::IsSingleWindowMetroMode()) { |
- AppMetroInfoBarDelegateWin::Create( |
- profile, AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP, |
- extension->id()); |
+ // On Windows 8's single window Metro mode we can not launch platform apps. |
+ // Offer to switch Chrome to desktop mode. |
+ if (win8::IsSingleWindowMetroMode()) { |
+ AppMetroInfoBarDelegateWin::Create( |
+ profile, AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP, |
+ extension->id()); |
+ return; |
+ } |
+#endif |
+ |
+ // An app with "kiosk_only" should not be installed and launched |
+ // outside of ChromeOS kiosk mode in the first place. This is a defensive |
+ // check in case this scenario does occur. |
+ if (extensions::KioskModeInfo::IsKioskOnly(extension)) { |
+ bool in_kiosk_mode = false; |
+#if defined(OS_CHROMEOS) |
+ chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
+ in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); |
+#endif |
+ if (!in_kiosk_mode) { |
+ LOG(ERROR) << "App with 'kiosk_only' attribute must be run in " |
+ << " ChromeOS kiosk mode."; |
+ NOTREACHED(); |
return; |
} |
-#endif |
+ } |
base::FilePath path; |
if (!GetAbsolutePathFromCommandLine(command_line, current_directory, &path)) { |