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

Unified Diff: chrome/browser/extensions/extension_service.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
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/platform_app_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index a041040b978c9421b524848464d2046d848942e2..0eb433083001da07a47284c5fb6168d21e38920f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
#include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
+#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/api/runtime/runtime_api.h"
#include "chrome/browser/extensions/api/storage/settings_frontend.h"
@@ -742,6 +743,11 @@ void ExtensionService::ReloadExtensionWithEvents(
}
on_load_events_[extension_id] = events;
+ if (events & EVENT_RESTARTED) {
+ extension_prefs_->GetSavedFileEntries(
+ extension_id, &on_restart_file_entries_[extension_id]);
+ }
+
if (delayed_updates_for_idle_.Contains(extension_id)) {
FinishDelayedInstallation(extension_id);
@@ -2901,9 +2907,16 @@ void ExtensionService::DoPostLoadTasks(const Extension* extension) {
if (events_to_fire & EVENT_LAUNCHED)
queue->AddPendingTask(profile(), extension->id(),
base::Bind(&ExtensionService::LaunchApplication));
- if (events_to_fire & EVENT_RESTARTED)
+ if (events_to_fire & EVENT_RESTARTED) {
+ SavedFileEntryMap::iterator it =
+ on_restart_file_entries_.find(extension->id());
+ if (it == on_restart_file_entries_.end())
+ NOTREACHED();
queue->AddPendingTask(profile(), extension->id(),
- base::Bind(&ExtensionService::RestartApplication));
+ base::Bind(&ExtensionService::RestartApplication,
+ it->second));
+ on_restart_file_entries_.erase(it);
+ }
}
on_load_events_.erase(it);
@@ -2924,13 +2937,14 @@ void ExtensionService::LaunchApplication(
// static
void ExtensionService::RestartApplication(
+ std::vector<extensions::app_file_handler_util::SavedFileEntry> file_entries,
extensions::ExtensionHost* extension_host) {
if (!extension_host)
return;
#if !defined(OS_ANDROID)
- extensions::AppEventRouter::DispatchOnRestartedEvent(
- extension_host->profile(), extension_host->extension());
+ extensions::RestartPlatformAppWithFileEntries(
+ extension_host->profile(), extension_host->extension(), file_entries);
#endif
}
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/platform_app_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698