Index: apps/launcher.cc |
diff --git a/apps/launcher.cc b/apps/launcher.cc |
index 02c630279efeff15a2e8a9b58552cc184014d8a2..e72623dd5aed0e6b3565dc3b709a86f50f390240 100644 |
--- a/apps/launcher.cc |
+++ b/apps/launcher.cc |
@@ -99,6 +99,7 @@ class PlatformAppPathLauncher |
const std::vector<base::FilePath>& entry_paths) |
: profile_(profile), |
extension_id(extension->id()), |
+ action_data_(), |
Daniel Erat
2016/08/10 22:19:24
nit: leave this out? (i'm guessing it has a defaul
|
entry_paths_(entry_paths), |
mime_type_collector_(profile), |
is_directory_collector_(profile) {} |
@@ -108,12 +109,21 @@ class PlatformAppPathLauncher |
const base::FilePath& file_path) |
: profile_(profile), |
extension_id(extension->id()), |
+ action_data_(), |
Daniel Erat
2016/08/10 22:19:24
nit: ditto
|
mime_type_collector_(profile), |
is_directory_collector_(profile) { |
if (!file_path.empty()) |
entry_paths_.push_back(file_path); |
} |
+ void set_action_data(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 +206,7 @@ class PlatformAppPathLauncher |
return; |
AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
- profile_, extension, extensions::SOURCE_FILE_HANDLER); |
+ profile_, extension, launch_source_, action_data_); |
} |
void OnAreDirectoriesCollected( |
@@ -310,7 +320,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 +335,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_; |
// 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 +388,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 +407,17 @@ void LaunchPlatformAppWithPath(Profile* profile, |
launcher->Launch(); |
} |
+void LaunchPlatformAppWithAction(Profile* profile, |
+ const extensions::Extension* extension, |
+ 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 +460,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>()); |
} |
} |