OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "apps/launcher.h" | 5 #include "apps/launcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 extensions::app_file_handler_util::IsDirectoryCollector | 352 extensions::app_file_handler_util::IsDirectoryCollector |
353 is_directory_collector_; | 353 is_directory_collector_; |
354 | 354 |
355 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); | 355 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); |
356 }; | 356 }; |
357 | 357 |
358 } // namespace | 358 } // namespace |
359 | 359 |
360 void LaunchPlatformAppWithCommandLine(Profile* profile, | 360 void LaunchPlatformAppWithCommandLine(Profile* profile, |
361 const extensions::Extension* app, | 361 const extensions::Extension* app, |
| 362 const std::string& launch_id, |
362 const base::CommandLine& command_line, | 363 const base::CommandLine& command_line, |
363 const base::FilePath& current_directory, | 364 const base::FilePath& current_directory, |
364 extensions::AppLaunchSource source, | 365 extensions::AppLaunchSource source, |
365 PlayStoreStatus play_store_status) { | 366 PlayStoreStatus play_store_status) { |
366 // An app with "kiosk_only" should not be installed and launched | 367 // An app with "kiosk_only" should not be installed and launched |
367 // outside of ChromeOS kiosk mode in the first place. This is a defensive | 368 // outside of ChromeOS kiosk mode in the first place. This is a defensive |
368 // check in case this scenario does occur. | 369 // check in case this scenario does occur. |
369 if (extensions::KioskModeInfo::IsKioskOnly(app)) { | 370 if (extensions::KioskModeInfo::IsKioskOnly(app)) { |
370 bool in_kiosk_mode = false; | 371 bool in_kiosk_mode = false; |
371 #if defined(OS_CHROMEOS) | 372 #if defined(OS_CHROMEOS) |
(...skipping 18 matching lines...) Expand all Loading... |
390 // Browser tests will add about:blank to the command line. This should | 391 // Browser tests will add about:blank to the command line. This should |
391 // never be interpreted as a file to open, as doing so with an app that | 392 // never be interpreted as a file to open, as doing so with an app that |
392 // has write access will result in a file 'about' being created, which | 393 // has write access will result in a file 'about' being created, which |
393 // causes problems on the bots. | 394 // causes problems on the bots. |
394 if (args.empty() || (command_line.HasSwitch(switches::kTestType) && | 395 if (args.empty() || (command_line.HasSwitch(switches::kTestType) && |
395 args[0] == about_blank_url)) { | 396 args[0] == about_blank_url)) { |
396 std::unique_ptr<app_runtime::LaunchData> launch_data = | 397 std::unique_ptr<app_runtime::LaunchData> launch_data = |
397 base::MakeUnique<app_runtime::LaunchData>(); | 398 base::MakeUnique<app_runtime::LaunchData>(); |
398 if (play_store_status != PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) | 399 if (play_store_status != PlayStoreStatus::PLAY_STORE_STATUS_UNKNOWN) |
399 launch_data->play_store_status = play_store_status; | 400 launch_data->play_store_status = play_store_status; |
| 401 launch_data->id.reset(new std::string(launch_id)); |
400 AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, app, source, | 402 AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, app, source, |
401 std::move(launch_data)); | 403 std::move(launch_data)); |
402 return; | 404 return; |
403 } | 405 } |
404 | 406 |
405 base::FilePath file_path(command_line.GetArgs()[0]); | 407 base::FilePath file_path(command_line.GetArgs()[0]); |
406 scoped_refptr<PlatformAppPathLauncher> launcher = | 408 scoped_refptr<PlatformAppPathLauncher> launcher = |
407 new PlatformAppPathLauncher(profile, app, file_path); | 409 new PlatformAppPathLauncher(profile, app, file_path); |
408 launcher->LaunchWithRelativePath(current_directory); | 410 launcher->LaunchWithRelativePath(current_directory); |
409 } | 411 } |
(...skipping 15 matching lines...) Expand all Loading... |
425 new PlatformAppPathLauncher(profile, app, file_path); | 427 new PlatformAppPathLauncher(profile, app, file_path); |
426 launcher->set_action_data(std::move(action_data)); | 428 launcher->set_action_data(std::move(action_data)); |
427 launcher->set_launch_source(extensions::AppLaunchSource::SOURCE_UNTRACKED); | 429 launcher->set_launch_source(extensions::AppLaunchSource::SOURCE_UNTRACKED); |
428 launcher->Launch(); | 430 launcher->Launch(); |
429 } | 431 } |
430 | 432 |
431 void LaunchPlatformApp(Profile* profile, | 433 void LaunchPlatformApp(Profile* profile, |
432 const Extension* app, | 434 const Extension* app, |
433 extensions::AppLaunchSource source) { | 435 extensions::AppLaunchSource source) { |
434 LaunchPlatformAppWithCommandLine( | 436 LaunchPlatformAppWithCommandLine( |
435 profile, app, base::CommandLine(base::CommandLine::NO_PROGRAM), | 437 profile, app, "", base::CommandLine(base::CommandLine::NO_PROGRAM), |
436 base::FilePath(), source); | 438 base::FilePath(), source); |
437 } | 439 } |
438 | 440 |
439 void LaunchPlatformAppWithFileHandler( | 441 void LaunchPlatformAppWithFileHandler( |
440 Profile* profile, | 442 Profile* profile, |
441 const Extension* app, | 443 const Extension* app, |
442 const std::string& handler_id, | 444 const std::string& handler_id, |
443 const std::vector<base::FilePath>& entry_paths) { | 445 const std::vector<base::FilePath>& entry_paths) { |
444 scoped_refptr<PlatformAppPathLauncher> launcher = | 446 scoped_refptr<PlatformAppPathLauncher> launcher = |
445 new PlatformAppPathLauncher(profile, app, entry_paths); | 447 new PlatformAppPathLauncher(profile, app, entry_paths); |
(...skipping 26 matching lines...) Expand all Loading... |
472 void LaunchPlatformAppWithUrl(Profile* profile, | 474 void LaunchPlatformAppWithUrl(Profile* profile, |
473 const Extension* app, | 475 const Extension* app, |
474 const std::string& handler_id, | 476 const std::string& handler_id, |
475 const GURL& url, | 477 const GURL& url, |
476 const GURL& referrer_url) { | 478 const GURL& referrer_url) { |
477 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( | 479 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( |
478 profile, app, handler_id, url, referrer_url); | 480 profile, app, handler_id, url, referrer_url); |
479 } | 481 } |
480 | 482 |
481 } // namespace apps | 483 } // namespace apps |
OLD | NEW |