Index: apps/launcher.cc |
diff --git a/apps/launcher.cc b/apps/launcher.cc |
index a4272a69b6e5e1079d1498bc278a8063048f1ea7..0eb18687de9c736c8888520a8fe82f96c1d968e1 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,8 @@ 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_); |
} |
void OnMimeTypesCollected(scoped_ptr<std::vector<std::string> > mime_types) { |
@@ -310,7 +303,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 +335,8 @@ 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::DispatchOnLaunchedEventWithSource( |
+ profile, extension, source); |
return; |
} |
@@ -363,7 +358,18 @@ void LaunchPlatformApp(Profile* profile, const Extension* extension) { |
LaunchPlatformAppWithCommandLine(profile, |
extension, |
CommandLine(CommandLine::NO_PROGRAM), |
- base::FilePath()); |
+ base::FilePath(), |
+ extensions::SOURCE_UNKNOWN); |
+} |
+ |
+void LaunchPlatformAppWithSource(Profile* profile, |
+ const Extension* extension, |
+ extensions::AppLaunchSource source) { |
+ LaunchPlatformAppWithCommandLine(profile, |
+ extension, |
+ CommandLine(CommandLine::NO_PROGRAM), |
+ base::FilePath(), |
+ source); |
} |
void LaunchPlatformAppWithFileHandler( |
@@ -386,7 +392,6 @@ void RestartPlatformApp(Profile* profile, const Extension* extension) { |
AppRuntimeEventRouter::DispatchOnRestartedEvent(profile, extension); |
return; |
} |
- |
extensions::ExtensionPrefs* extension_prefs = |
extensions::ExtensionPrefs::Get(profile); |
bool had_windows = extension_prefs->IsActive(extension->id()); |
@@ -395,8 +400,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::DispatchOnLaunchedEventWithSource( |
+ profile, extension, extensions::SOURCE_RESTART); |
+ } |
} |
void LaunchPlatformAppWithUrl(Profile* profile, |