Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Unified Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc

Issue 12391006: Give an app the file entries it had back on restart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile (chromium style) Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ff70376b983b43f61ed13a2c653a21a7463ba1c6..10e29f57551c4e5354aee6314c9481470ff96175 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()->
« no previous file with comments | « chrome/browser/extensions/api/app_runtime/app_runtime_api.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698