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

Unified Diff: apps/app_restore_service.cc

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 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 | « apps/app_restore_service.h ('k') | apps/app_restore_service_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_restore_service.cc
diff --git a/apps/app_restore_service.cc b/apps/app_restore_service.cc
index a567811289f4d1f5b2b6d41d75b0fe3edcc226c1..88ac811840b761fe8cf0a8723858e2cb81499557 100644
--- a/apps/app_restore_service.cc
+++ b/apps/app_restore_service.cc
@@ -4,8 +4,8 @@
#include "apps/app_restore_service.h"
+#include "apps/saved_files_service.h"
#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.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_host.h"
#include "chrome/browser/extensions/extension_prefs.h"
@@ -70,13 +70,16 @@ void AppRestoreService::HandleStartup(bool should_restore_apps) {
it != extensions->end(); ++it) {
const Extension* extension = *it;
if (extension_prefs->IsExtensionRunning(extension->id())) {
- std::vector<SavedFileEntry> file_entries;
- extensions::app_file_handler_util::GetSavedFileEntries(extension_prefs,
- extension->id(),
- &file_entries);
RecordAppStop(extension->id());
- if (should_restore_apps)
- RestoreApp(*it, file_entries);
+ // If we are not restoring apps (e.g., because it is a clean restart), and
+ // the app does not have retain permission, explicitly clear the retained
+ // entries queue.
+ if (should_restore_apps) {
+ RestoreApp(*it);
+ } else {
+ SavedFilesService::Get(profile_)->ClearQueueIfNoRetainPermission(
+ extension);
+ }
}
}
}
@@ -138,8 +141,6 @@ void AppRestoreService::RecordAppStop(const std::string& extension_id) {
ExtensionPrefs* extension_prefs =
ExtensionSystem::Get(profile_)->extension_service()->extension_prefs();
extension_prefs->SetExtensionRunning(extension_id, false);
- extensions::app_file_handler_util::ClearSavedFileEntries(
- extension_prefs, extension_id);
}
void AppRestoreService::RecordIfAppHasWindows(
@@ -162,12 +163,8 @@ void AppRestoreService::RecordIfAppHasWindows(
extension_prefs->SetHasWindows(id, has_windows);
}
-void AppRestoreService::RestoreApp(
- const Extension* extension,
- const std::vector<SavedFileEntry>& file_entries) {
- extensions::RestartPlatformAppWithFileEntries(profile_,
- extension,
- file_entries);
+void AppRestoreService::RestoreApp(const Extension* extension) {
+ extensions::RestartPlatformApp(profile_, extension);
}
void AppRestoreService::StartObservingShellWindows() {
« no previous file with comments | « apps/app_restore_service.h ('k') | apps/app_restore_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698