diff options
author | sammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-25 14:09:24 +0000 |
---|---|---|
committer | sammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-25 14:09:24 +0000 |
commit | 961745f2cca727fe6144a28fd16ca536dbd94768 (patch) | |
tree | 0437c54836347b13227b0a45824cdbadefc0f063 /apps/saved_files_service_factory.cc | |
parent | 1b6a233a4f2af1a5c02c99f0c8958b14d3efafbb (diff) | |
download | chromium_src-961745f2cca727fe6144a28fd16ca536dbd94768.zip chromium_src-961745f2cca727fe6144a28fd16ca536dbd94768.tar.gz chromium_src-961745f2cca727fe6144a28fd16ca536dbd94768.tar.bz2 |
Add support for persistent file access in apps.
This replaces chrome.fileSystem.getEntry(By)Id with retainEntry,
restoreEntry and isRestorable, which enable restoring file access after
an app is closed for apps with the fileSystem.retainFiles permission.
Retained files are evicted by LRU, with a maximum of 500 retained files.
BUG=224684
Review URL: https://chromiumcodereview.appspot.com/14607023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/saved_files_service_factory.cc')
-rw-r--r-- | apps/saved_files_service_factory.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/saved_files_service_factory.cc b/apps/saved_files_service_factory.cc new file mode 100644 index 0000000..c904770 --- /dev/null +++ b/apps/saved_files_service_factory.cc @@ -0,0 +1,36 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "apps/saved_files_service_factory.h" + +#include "apps/saved_files_service.h" +#include "chrome/browser/profiles/profile.h" +#include "components/browser_context_keyed_service/browser_context_dependency_manager.h" + +namespace apps { + +// static +SavedFilesService* SavedFilesServiceFactory::GetForProfile(Profile* profile) { + return static_cast<SavedFilesService*>( + GetInstance()->GetServiceForBrowserContext(profile, true)); +} + +// static +SavedFilesServiceFactory* SavedFilesServiceFactory::GetInstance() { + return Singleton<SavedFilesServiceFactory>::get(); +} + +SavedFilesServiceFactory::SavedFilesServiceFactory() + : BrowserContextKeyedServiceFactory( + "SavedFilesService", + BrowserContextDependencyManager::GetInstance()) {} + +SavedFilesServiceFactory::~SavedFilesServiceFactory() {} + +BrowserContextKeyedService* SavedFilesServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* profile) const { + return new SavedFilesService(static_cast<Profile*>(profile)); +} + +} // namespace apps |