diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 17:46:13 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 17:46:13 +0000 |
commit | a3703dd92f9779ada9486a9781b05d071e836099 (patch) | |
tree | bb9673d0a5eb14cc5953f86808d17d45e78d805f /webkit/database | |
parent | 18fe172980c11836c129b4cdc30e5530c77c10a0 (diff) | |
download | chromium_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')
-rw-r--r-- | webkit/database/database_util.cc | 17 | ||||
-rw-r--r-- | webkit/database/database_util.h | 4 | ||||
-rw-r--r-- | webkit/database/vfs_backend.cc | 22 | ||||
-rw-r--r-- | webkit/database/vfs_backend.h | 7 |
4 files changed, 40 insertions, 10 deletions
diff --git a/webkit/database/database_util.cc b/webkit/database/database_util.cc index ae52a5a..4866b30 100644 --- a/webkit/database/database_util.cc +++ b/webkit/database/database_util.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. @@ -28,11 +28,16 @@ bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, return false; } - *origin_identifier = vfs_file_name.substr(0, first_slash_index); - *database_name = vfs_file_name.substr( - first_slash_index + 1, last_pound_index - first_slash_index - 1); - *sqlite_suffix = vfs_file_name.substr( - last_pound_index + 1, vfs_file_name.length() - last_pound_index - 1); + if (origin_identifier) + *origin_identifier = vfs_file_name.substr(0, first_slash_index); + if (database_name) { + *database_name = vfs_file_name.substr( + first_slash_index + 1, last_pound_index - first_slash_index - 1); + } + if (sqlite_suffix) { + *sqlite_suffix = vfs_file_name.substr( + last_pound_index + 1, vfs_file_name.length() - last_pound_index - 1); + } return true; } diff --git a/webkit/database/database_util.h b/webkit/database/database_util.h index c18e5f4..2aa35b3 100644 --- a/webkit/database/database_util.h +++ b/webkit/database/database_util.h @@ -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. @@ -14,6 +14,8 @@ class DatabaseTracker; class DatabaseUtil { public: + // Extract various information from a database vfs_file_name. All return + // parameters are optional. static bool CrackVfsFileName(const string16& vfs_file_name, string16* origin_identifier, string16* database_name, 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); diff --git a/webkit/database/vfs_backend.h b/webkit/database/vfs_backend.h index 44de808..97ce7e0 100644 --- a/webkit/database/vfs_backend.h +++ b/webkit/database/vfs_backend.h @@ -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. @@ -20,6 +20,7 @@ class VfsBackend { base::ProcessHandle handle, base::PlatformFile* target_handle, base::PlatformFile* target_dir_handle); + static void OpenTempFileInDirectory(const FilePath& dir_path, int desired_flags, base::ProcessHandle handle, @@ -32,6 +33,10 @@ class VfsBackend { static int64 GetFileSize(const FilePath& file_path); + // Used to make decisions in the DatabaseDispatcherHost. + static bool FileTypeIsMainDB(int desired_flags); + static bool OpenTypeIsReadWrite(int desired_flags); + private: static bool OpenFileFlagsAreConsistent(int desired_flags); }; |