Index: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
diff --git a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
index b976dc7f9a8892ed3667d109c87921a7825ce489..f48164d9d3bae381daa23aba3729225e227f52b5 100644 |
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
@@ -61,6 +61,8 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
Profile* profile, const Extension* extension, |
const std::string& handler_id, const std::string& mime_type, |
const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { |
+ // TODO(sergeygs): Use the same way of creating an event (using the generated |
+ // boilerplate) as below in DispatchOnLaunchedEventWithUrl. |
scoped_ptr<base::ListValue> args(new base::ListValue()); |
base::DictionaryValue* launch_data = new base::DictionaryValue(); |
launch_data->SetString("id", handler_id); |
@@ -76,4 +78,20 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
} |
+// static. |
+void AppEventRouter::DispatchOnLaunchedEventWithUrl( |
+ Profile* profile, |
+ const Extension* extension, |
+ const std::string& handler_id, |
+ const GURL& url, |
+ const GURL& referrer_url) { |
+ api::app_runtime::LaunchData launch_data; |
+ launch_data.id.reset(new std::string(handler_id)); |
+ launch_data.url.reset(new std::string(url.spec())); |
+ launch_data.referrer_url.reset(new std::string(referrer_url.spec())); |
+ scoped_ptr<ListValue> args(new ListValue()); |
+ args->Append(launch_data.ToValue().release()); |
+ DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
+} |
+ |
} // namespace extensions |