Chromium Code Reviews| Index: chrome/browser/extensions/api/app/app_api.cc |
| diff --git a/chrome/browser/extensions/api/app/app_api.cc b/chrome/browser/extensions/api/app/app_api.cc |
| index d429710f0fb7355c0a083c9e8da9509cbc7178bc..4d03b2fe1a077da801417c94a021cfd86b1f8089 100644 |
| --- a/chrome/browser/extensions/api/app/app_api.cc |
| +++ b/chrome/browser/extensions/api/app/app_api.cc |
| @@ -4,8 +4,10 @@ |
| #include "chrome/browser/extensions/api/app/app_api.h" |
| +#include "base/json/json_writer.h" |
| #include "base/values.h" |
| #include "base/time.h" |
| +#include "base/utf_string_conversions.h" |
| #include "chrome/browser/extensions/app_notification_manager.h" |
| #include "chrome/browser/extensions/extension_event_router.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| @@ -120,4 +122,24 @@ void AppEventRouter::DispatchOnLaunchedEvent( |
| extension->id(), kOnLaunchedEvent, "[]", NULL, GURL()); |
| } |
| +// static. |
| +void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
| + Profile* profile, const Extension* extension, const string16& action, |
| + const std::string& mime_type, const std::string& file_system_id, |
| + const std::string& base_name) { |
| + ListValue args; |
| + DictionaryValue* launch_data = new DictionaryValue(); |
| + DictionaryValue* intent = new DictionaryValue(); |
| + intent->SetString("action", UTF16ToUTF8(action)); |
| + intent->SetString("type", mime_type); |
|
Greg Billock
2012/05/18 14:14:39
Our documentation for MIME type passing is here: h
benwells
2012/05/21 04:26:32
Greg: I want to make sure I understand properly: d
Greg Billock
2012/05/21 14:25:34
Right. We don't really have a limitation on the ty
benwells
2012/05/22 13:15:03
Done.
|
| + launch_data->Set("intent", intent); |
| + args.Append(launch_data); |
| + args.Append(Value::CreateStringValue(file_system_id)); |
| + args.Append(Value::CreateStringValue(base_name)); |
| + std::string json_args; |
| + base::JSONWriter::Write(&args, &json_args); |
| + profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| + extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); |
| +} |
| + |
| } // namespace extensions |