Chromium Code Reviews| Index: apps/launcher.cc |
| diff --git a/apps/launcher.cc b/apps/launcher.cc |
| index a4272a69b6e5e1079d1498bc278a8063048f1ea7..1fade2b1cc5623731688011f95c20c0339c04713 100644 |
| --- a/apps/launcher.cc |
| +++ b/apps/launcher.cc |
| @@ -82,14 +82,6 @@ bool DoMakePathAbsolute(const base::FilePath& current_directory, |
| return true; |
| } |
| -// Helper method to launch the platform app |extension| with no data. This |
| -// should be called in the fallback case, where it has been impossible to |
| -// load or obtain file launch data. |
| -void LaunchPlatformAppWithNoData(Profile* profile, const Extension* extension) { |
| - DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| - AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, extension); |
| -} |
| - |
| // Class to handle launching of platform apps to open specific paths. |
| // An instance of this class is created for each launch. The lifetime of these |
| // instances is managed by reference counted pointers. As long as an instance |
| @@ -117,7 +109,7 @@ class PlatformAppPathLauncher |
| void Launch() { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| if (file_paths_.empty()) { |
| - LaunchPlatformAppWithNoData(profile_, extension_); |
| + LaunchWithNoLaunchData(); |
| return; |
| } |
| @@ -190,7 +182,9 @@ class PlatformAppPathLauncher |
| void LaunchWithNoLaunchData() { |
| // This method is required as an entry point on the UI thread. |
| - LaunchPlatformAppWithNoData(profile_, extension_); |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
| + profile_, extension_, extensions::SOURCE_UNKNOWN); |
|
benwells
2014/10/28 21:22:47
Why is this unknown? I think we should plumb throu
cylee1
2014/10/29 16:39:59
This function is called only for the failure case
cylee1
2014/10/29 17:23:49
Changed to SOURCE_FILE_HANDLER anyway since it's o
|
| } |
| void OnMimeTypesCollected(scoped_ptr<std::vector<std::string> > mime_types) { |
| @@ -310,7 +304,8 @@ class PlatformAppPathLauncher |
| void LaunchPlatformAppWithCommandLine(Profile* profile, |
| const Extension* extension, |
| const CommandLine& command_line, |
| - const base::FilePath& current_directory) { |
| + const base::FilePath& current_directory, |
| + extensions::AppLaunchSource source) { |
| // 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. |
| @@ -341,7 +336,7 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, |
| // causes problems on the bots. |
| if (args.empty() || (command_line.HasSwitch(switches::kTestType) && |
| args[0] == about_blank_url)) { |
| - LaunchPlatformAppWithNoData(profile, extension); |
| + AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, extension, source); |
| return; |
| } |
| @@ -359,11 +354,14 @@ void LaunchPlatformAppWithPath(Profile* profile, |
| launcher->Launch(); |
| } |
| -void LaunchPlatformApp(Profile* profile, const Extension* extension) { |
| +void LaunchPlatformApp(Profile* profile, |
| + const Extension* extension, |
| + extensions::AppLaunchSource source) { |
| LaunchPlatformAppWithCommandLine(profile, |
| extension, |
| CommandLine(CommandLine::NO_PROGRAM), |
| - base::FilePath()); |
| + base::FilePath(), |
| + source); |
| } |
| void LaunchPlatformAppWithFileHandler( |
| @@ -386,7 +384,6 @@ void RestartPlatformApp(Profile* profile, const Extension* extension) { |
| AppRuntimeEventRouter::DispatchOnRestartedEvent(profile, extension); |
| return; |
| } |
| - |
|
benwells
2014/10/28 21:22:47
Nit: keep the empty line here.
cylee1
2014/10/29 16:39:59
Done.
|
| extensions::ExtensionPrefs* extension_prefs = |
| extensions::ExtensionPrefs::Get(profile); |
| bool had_windows = extension_prefs->IsActive(extension->id()); |
| @@ -395,8 +392,10 @@ void RestartPlatformApp(Profile* profile, const Extension* extension) { |
| ExtensionHasEventListener(extension->id(), |
| app_runtime::OnLaunched::kEventName); |
| - if (listening_to_launch && had_windows) |
| - LaunchPlatformAppWithNoData(profile, extension); |
| + if (listening_to_launch && had_windows) { |
| + AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
| + profile, extension, extensions::SOURCE_RESTART); |
| + } |
| } |
| void LaunchPlatformAppWithUrl(Profile* profile, |