Chromium Code Reviews| Index: apps/launcher.cc |
| diff --git a/apps/launcher.cc b/apps/launcher.cc |
| index 1ac5aef27947de679163f78d81d4f6998fe81ea3..56cf5a62f7f9f65cec3a21f9bcfc862f4b36c13c 100644 |
| --- a/apps/launcher.cc |
| +++ b/apps/launcher.cc |
| @@ -408,6 +408,60 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, |
| launcher->LaunchWithRelativePath(current_directory); |
| } |
| +void LaunchPlatformAppWithCommandLineAndLaunchId( |
| + Profile* profile, |
| + const extensions::Extension* app, |
| + const std::string& launch_id, |
| + const base::CommandLine& command_line, |
| + const base::FilePath& current_directory, |
| + extensions::AppLaunchSource source, |
| + PlayStoreStatus play_store_status) { |
| + // 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(app)) { |
| + bool in_kiosk_mode = false; |
| +#if defined(OS_CHROMEOS) |
| + user_manager::UserManager* user_manager = user_manager::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; |
| + } |
| + } |
|
stevenjb
2016/12/06 16:42:07
Don't duplucate all of this code, have LaunchPlatf
Andra Paraschiv
2016/12/07 08:33:21
Yes, sorry for this, I fixed it now.
|
| + |
| +#if defined(OS_WIN) |
| + base::CommandLine::StringType about_blank_url( |
| + base::ASCIIToUTF16(url::kAboutBlankURL)); |
| +#else |
| + base::CommandLine::StringType about_blank_url(url::kAboutBlankURL); |
| +#endif |
| + base::CommandLine::StringVector args = command_line.GetArgs(); |
| + // Browser tests will add about:blank to the command line. This should |
| + // never be interpreted as a file to open, as doing so with an app that |
| + // has write access will result in a file 'about' being created, which |
| + // causes problems on the bots. |
| + if (args.empty() || (command_line.HasSwitch(switches::kTestType) && |
| + args[0] == about_blank_url)) { |
| + std::unique_ptr<app_runtime::LaunchData> launch_data = |
| + base::MakeUnique<app_runtime::LaunchData>(); |
| + if (play_store_status != PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) |
| + launch_data->play_store_status = play_store_status; |
| + launch_data->id.reset(new std::string(launch_id)); |
| + AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, app, source, |
| + std::move(launch_data)); |
| + return; |
| + } |
| + |
| + base::FilePath file_path(command_line.GetArgs()[0]); |
| + scoped_refptr<PlatformAppPathLauncher> launcher = |
| + new PlatformAppPathLauncher(profile, app, file_path); |
| + launcher->LaunchWithRelativePath(current_directory); |
| +} |
| + |
| void LaunchPlatformAppWithPath(Profile* profile, |
| const Extension* app, |
| const base::FilePath& file_path) { |