summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/api/app_runtime/app_runtime_api.cc')
-rw-r--r--chrome/browser/extensions/api/app_runtime/app_runtime_api.cc21
1 files changed, 20 insertions, 1 deletions
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 ff70376..10e29f57 100644
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
@@ -9,6 +9,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
@@ -51,10 +52,28 @@ void AppEventRouter::DispatchOnLaunchedEvent(
DispatchOnLaunchedEventImpl(extension->id(), arguments.Pass(), profile);
}
+DictionaryValue* DictionaryFromSavedFileEntry(
+ const app_file_handler_util::GrantedFileEntry& file_entry) {
+ DictionaryValue* result = new DictionaryValue();
+ result->SetString("id", file_entry.id);
+ result->SetString("fileSystemId", file_entry.filesystem_id);
+ result->SetString("baseName", file_entry.registered_name);
+ return result;
+}
+
// static.
void AppEventRouter::DispatchOnRestartedEvent(
- Profile* profile, const Extension* extension) {
+ Profile* profile,
+ const Extension* extension,
+ const std::vector<app_file_handler_util::GrantedFileEntry>& file_entries) {
+ ListValue* file_entries_list = new ListValue();
+ for (std::vector<extensions::app_file_handler_util::GrantedFileEntry>
+ ::const_iterator it = file_entries.begin(); it != file_entries.end();
+ ++it) {
+ file_entries_list->Append(DictionaryFromSavedFileEntry(*it));
+ }
scoped_ptr<ListValue> arguments(new ListValue());
+ arguments->Append(file_entries_list);
scoped_ptr<Event> event(new Event(kOnRestartedEvent, arguments.Pass()));
event->restrict_to_profile = profile;
extensions::ExtensionSystem::Get(profile)->event_router()->