diff options
author | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 08:42:30 +0000 |
---|---|---|
committer | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 08:42:30 +0000 |
commit | 14a18bf29f50bccceb3be7ba9aefb7b9ce5834c3 (patch) | |
tree | d40092078c383546966826641e24c4af5409991d /apps | |
parent | dec3e9395662225cc8535562f55b401bcda4d26d (diff) | |
download | chromium_src-14a18bf29f50bccceb3be7ba9aefb7b9ce5834c3.zip chromium_src-14a18bf29f50bccceb3be7ba9aefb7b9ce5834c3.tar.gz chromium_src-14a18bf29f50bccceb3be7ba9aefb7b9ce5834c3.tar.bz2 |
Add "kiosk_only" manifest attribute for platform apps.
This top-level manifest attribute enforces that the app can only be installed and run in ChromeOS kiosk mode.
BUG=284964
TEST=added new tests
Review URL: https://codereview.chromium.org/23604068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/DEPS | 2 | ||||
-rw-r--r-- | apps/launcher.cc | 33 |
2 files changed, 28 insertions, 7 deletions
@@ -15,6 +15,7 @@ include_rules = [ "+chrome/browser/browser_process.h", "+chrome/browser/chrome_notification_types.h", "+chrome/browser/chromeos/drive", + "+chrome/browser/chromeos/login/user_manager.h", "+chrome/browser/lifetime/application_lifetime.h", "+chrome/browser/profiles", "+chrome/browser/sessions/session_id.h", @@ -47,6 +48,7 @@ include_rules = [ "+chrome/common/extensions/extension_messages.h", "+chrome/common/extensions/extension_set.h", "+chrome/common/extensions/manifest_handlers/icons_handler.h", + "+chrome/common/extensions/manifest_handlers/kiosk_mode_info.h", "+chrome/common/extensions/permissions/api_permission.h", "+chrome/common/extensions/permissions/permission_set.h", ] diff --git a/apps/launcher.cc b/apps/launcher.cc index aae298f..384d271 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)) { |