summaryrefslogtreecommitdiffstats
path: root/webkit/database/vfs_backend.cc
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 17:46:13 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 17:46:13 +0000
commita3703dd92f9779ada9486a9781b05d071e836099 (patch)
treebb9673d0a5eb14cc5953f86808d17d45e78d805f /webkit/database/vfs_backend.cc
parent18fe172980c11836c129b4cdc30e5530c77c10a0 (diff)
downloadchromium_src-a3703dd92f9779ada9486a9781b05d071e836099.zip
chromium_src-a3703dd92f9779ada9486a9781b05d071e836099.tar.gz
chromium_src-a3703dd92f9779ada9486a9781b05d071e836099.tar.bz2
Add support for CONTENT_SETTING_ASK to database.
TEST=none BUG=none Review URL: http://codereview.chromium.org/572001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database/vfs_backend.cc')
-rw-r--r--webkit/database/vfs_backend.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/webkit/database/vfs_backend.cc b/webkit/database/vfs_backend.cc
index 2c5467f..8c1b50b 100644
--- a/webkit/database/vfs_backend.cc
+++ b/webkit/database/vfs_backend.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -16,8 +16,21 @@
namespace webkit_database {
+static const int kFileTypeMask = 0x00007F00;
+
+// static
+bool VfsBackend::FileTypeIsMainDB(int desired_flags) {
+ return (desired_flags & kFileTypeMask) == SQLITE_OPEN_MAIN_DB;
+}
+
+// static
+bool VfsBackend::OpenTypeIsReadWrite(int desired_flags) {
+ return desired_flags & SQLITE_OPEN_READWRITE;
+}
+
+// static
bool VfsBackend::OpenFileFlagsAreConsistent(int desired_flags) {
- const int file_type = desired_flags & 0x00007F00;
+ const int file_type = desired_flags & kFileTypeMask;
const bool is_exclusive = (desired_flags & SQLITE_OPEN_EXCLUSIVE) != 0;
const bool is_delete = (desired_flags & SQLITE_OPEN_DELETEONCLOSE) != 0;
const bool is_create = (desired_flags & SQLITE_OPEN_CREATE) != 0;
@@ -54,6 +67,7 @@ bool VfsBackend::OpenFileFlagsAreConsistent(int desired_flags) {
(file_type == SQLITE_OPEN_TRANSIENT_DB);
}
+// static
void VfsBackend::OpenFile(const FilePath& file_path,
int desired_flags,
base::ProcessHandle handle,
@@ -124,6 +138,7 @@ void VfsBackend::OpenFile(const FilePath& file_path,
}
}
+// static
void VfsBackend::OpenTempFileInDirectory(
const FilePath& dir_path,
int desired_flags,
@@ -146,6 +161,7 @@ void VfsBackend::OpenTempFileInDirectory(
target_handle, target_dir_handle);
}
+// static
int VfsBackend::DeleteFile(const FilePath& file_path, bool sync_dir) {
if (!file_util::PathExists(file_path))
return SQLITE_OK;
@@ -169,6 +185,7 @@ int VfsBackend::DeleteFile(const FilePath& file_path, bool sync_dir) {
return error_code;
}
+// static
uint32 VfsBackend::GetFileAttributes(const FilePath& file_path) {
#if defined(OS_WIN)
uint32 attributes = ::GetFileAttributes(file_path.value().c_str());
@@ -184,6 +201,7 @@ uint32 VfsBackend::GetFileAttributes(const FilePath& file_path) {
return attributes;
}
+// static
int64 VfsBackend::GetFileSize(const FilePath& file_path) {
int64 size = 0;
return (file_util::GetFileSize(file_path, &size) ? size : 0);