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

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: rebase 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/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index a041040b978c9421b524848464d2046d848942e2..2191e3250ad0d0a5985452ca25f53f6c7c737c5c 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,9 @@ void ExtensionService::ReloadExtensionWithEvents(
}
on_load_events_[extension_id] = events;
+ extension_prefs_->GetSavedFileEntries(
benwells 2013/03/13 03:58:29 Should it just do this if events & RESTART?
koz (OOO until 15th September) 2013/03/13 05:01:13 Yes, good spot. Done.
+ extension_id, &on_restart_file_entries_[extension_id]);
+
if (delayed_updates_for_idle_.Contains(extension_id)) {
FinishDelayedInstallation(extension_id);
@@ -2901,9 +2905,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();
benwells 2013/03/13 03:58:29 I'm not quite sure about this NOTREACHED. It feels
koz (OOO until 15th September) 2013/03/13 05:01:13 Yeah, my rationale is that it'd be a programmer er
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 +2935,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
}

Powered by Google App Engine
This is Rietveld 408576698