Index: apps/launcher.cc |
diff --git a/apps/launcher.cc b/apps/launcher.cc |
index 02c630279efeff15a2e8a9b58552cc184014d8a2..f16313b38885afa17c0628d040e015bd8d791e5c 100644 |
--- a/apps/launcher.cc |
+++ b/apps/launcher.cc |
@@ -114,6 +114,14 @@ class PlatformAppPathLauncher |
entry_paths_.push_back(file_path); |
} |
+ void set_action_data(const extensions::ActionData& action_data) { |
+ action_data_ = action_data; |
+ } |
+ |
+ void set_launch_source(extensions::AppLaunchSource launch_source) { |
+ launch_source_ = launch_source; |
+ } |
+ |
void Launch() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
@@ -196,7 +204,7 @@ class PlatformAppPathLauncher |
return; |
AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
- profile_, extension, extensions::SOURCE_FILE_HANDLER); |
+ profile_, extension, launch_source_, action_data_); |
} |
void OnAreDirectoriesCollected( |
@@ -310,7 +318,8 @@ class PlatformAppPathLauncher |
} |
AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( |
- profile_, extension, handler_id_, entries_, granted_entries); |
+ profile_, extension, launch_source_, handler_id_, entries_, |
+ granted_entries, action_data_); |
} |
const Extension* GetExtension() const { |
@@ -324,6 +333,8 @@ class PlatformAppPathLauncher |
// not kept as the extension may be unloaded and deleted during the course of |
// the launch. |
const std::string extension_id; |
+ extensions::AppLaunchSource launch_source_ = extensions::SOURCE_FILE_HANDLER; |
+ base::Optional<extensions::ActionData> action_data_; |
Devlin
2016/08/11 20:51:20
Why an optional instead of a unique_ptr here?
jdufault
2016/08/12 18:56:54
It conveyed intent more clearly. With the removal
|
// A list of files and directories to be passed through to the app. |
std::vector<base::FilePath> entry_paths_; |
// A corresponding list with EntryInfo for every base::FilePath in |
@@ -375,7 +386,8 @@ void LaunchPlatformAppWithCommandLine(Profile* profile, |
// causes problems on the bots. |
if (args.empty() || (command_line.HasSwitch(switches::kTestType) && |
args[0] == about_blank_url)) { |
- AppRuntimeEventRouter::DispatchOnLaunchedEvent(profile, extension, source); |
+ AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
+ profile, extension, source, base::Optional<extensions::ActionData>()); |
return; |
} |
@@ -393,6 +405,17 @@ void LaunchPlatformAppWithPath(Profile* profile, |
launcher->Launch(); |
} |
+void LaunchPlatformAppWithAction(Profile* profile, |
+ const extensions::Extension* extension, |
+ const extensions::ActionData& action_data, |
+ const base::FilePath& file_path) { |
+ scoped_refptr<PlatformAppPathLauncher> launcher = |
+ new PlatformAppPathLauncher(profile, extension, file_path); |
+ launcher->set_action_data(action_data); |
+ launcher->set_launch_source(extensions::AppLaunchSource::SOURCE_UNTRACKED); |
+ launcher->Launch(); |
+} |
+ |
void LaunchPlatformApp(Profile* profile, |
const Extension* extension, |
extensions::AppLaunchSource source) { |
@@ -435,7 +458,8 @@ void RestartPlatformApp(Profile* profile, const Extension* extension) { |
if (listening_to_launch && had_windows) { |
AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
- profile, extension, extensions::SOURCE_RESTART); |
+ profile, extension, extensions::SOURCE_RESTART, |
+ base::Optional<extensions::ActionData>()); |
} |
} |