summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_path_manager.cc
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 11:05:54 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 11:05:54 +0000
commita13832a1c24681144c0d6ec31be09d812eacd285 (patch)
treea8d2c9bf5b3957a6df5f7cfdc3bf73a4fa801d7f /webkit/fileapi/file_system_path_manager.cc
parente1943b7dda014c0f3f3304ea256e13c3d484e25d (diff)
downloadchromium_src-a13832a1c24681144c0d6ec31be09d812eacd285.zip
chromium_src-a13832a1c24681144c0d6ec31be09d812eacd285.tar.gz
chromium_src-a13832a1c24681144c0d6ec31be09d812eacd285.tar.bz2
Add a utility method that returns a list of origins that have FileSystem storage.
The method is to be used to retrieve total amount of usage for a type, to collect all the origins at startup after initialization etc. BUG=none TEST=FileSystemUtilListOriginsTest Review URL: http://codereview.chromium.org/6524038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75582 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_path_manager.cc')
-rw-r--r--webkit/fileapi/file_system_path_manager.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/webkit/fileapi/file_system_path_manager.cc b/webkit/fileapi/file_system_path_manager.cc
index 8aee5d5..8ef0631 100644
--- a/webkit/fileapi/file_system_path_manager.cc
+++ b/webkit/fileapi/file_system_path_manager.cc
@@ -4,12 +4,12 @@
#include "webkit/fileapi/file_system_path_manager.h"
-#include "base/file_util.h"
#include "base/rand_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
#include "base/scoped_callback_factory.h"
+#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -351,6 +351,27 @@ FilePath FileSystemPathManager::GetFileSystemBaseDirectoryForOriginAndType(
.AppendASCII(type_string);
}
+FileSystemPathManager::OriginEnumerator::OriginEnumerator(
+ const FilePath& base_path)
+ : enumerator_(base_path, false /* recursive */,
+ file_util::FileEnumerator::DIRECTORIES) {
+}
+
+std::string FileSystemPathManager::OriginEnumerator::Next() {
+ current_ = enumerator_.Next();
+ return FilePathStringToASCII(current_.BaseName().value());
+}
+
+bool FileSystemPathManager::OriginEnumerator::HasTemporary() {
+ return !current_.empty() && file_util::DirectoryExists(current_.AppendASCII(
+ FileSystemPathManager::kTemporaryName));
+}
+
+bool FileSystemPathManager::OriginEnumerator::HasPersistent() {
+ return !current_.empty() && file_util::DirectoryExists(current_.AppendASCII(
+ FileSystemPathManager::kPersistentName));
+}
+
} // namespace fileapi
COMPILE_ASSERT(int(WebFileSystem::TypeTemporary) == \