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

Unified Diff: apps/launcher.cc

Issue 23604068: Add "kiosk_only" manifest attribute for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed .crx binary Created 7 years, 3 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
« no previous file with comments | « apps/DEPS ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
« no previous file with comments | « apps/DEPS ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698