summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 05:47:15 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 05:47:15 +0000
commitc870c76357fc05d3f7181f8121181f983bd25e7f (patch)
tree4757d379e295e2a594e63d53a0d3b4fe51c77379 /chrome/common
parent0b88baec73430cb25a4d6181b47c221f99fe5d0f (diff)
downloadchromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.zip
chromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.tar.gz
chromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.tar.bz2
Safe browsing cleanup:
* wstring -> FilePath * create versions of WriteFile/ReadFile with FilePath signatures Review URL: http://codereview.chromium.org/19610 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_constants.cc6
-rw-r--r--chrome/common/chrome_constants.h4
-rw-r--r--chrome/common/sqlite_utils.cc10
-rw-r--r--chrome/common/sqlite_utils.h9
4 files changed, 25 insertions, 4 deletions
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 17c8314..35cb15f 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -4,6 +4,10 @@
#include "chrome/common/chrome_constants.h"
+#include "base/file_path.h"
+
+#define FPL FILE_PATH_LITERAL
+
namespace chrome {
// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
@@ -31,7 +35,7 @@ const wchar_t kCookieFilename[] = L"Cookies";
const wchar_t kHistoryFilename[] = L"History";
const wchar_t kLocalStateFilename[] = L"Local State";
const wchar_t kPreferencesFilename[] = L"Preferences";
-const wchar_t kSafeBrowsingFilename[] = L"Safe Browsing";
+const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
const wchar_t kThumbnailsFilename[] = L"Thumbnails";
const wchar_t kUserDataDirname[] = L"User Data";
const wchar_t kUserScriptsDirname[] = L"User Scripts";
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index 5e59578..2cf8c2d 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -7,6 +7,8 @@
#ifndef CHROME_COMMON_CHROME_CONSTANTS_H__
#define CHROME_COMMON_CHROME_CONSTANTS_H__
+#include "base/file_path.h"
+
namespace chrome {
extern const wchar_t kBrowserProcessExecutableName[];
@@ -28,7 +30,7 @@ extern const wchar_t kCookieFilename[];
extern const wchar_t kHistoryFilename[];
extern const wchar_t kLocalStateFilename[];
extern const wchar_t kPreferencesFilename[];
-extern const wchar_t kSafeBrowsingFilename[];
+extern const FilePath::CharType kSafeBrowsingFilename[];
extern const wchar_t kThumbnailsFilename[];
extern const wchar_t kUserDataDirname[];
extern const wchar_t kUserScriptsDirname[];
diff --git a/chrome/common/sqlite_utils.cc b/chrome/common/sqlite_utils.cc
index d881a49..e45614a 100644
--- a/chrome/common/sqlite_utils.cc
+++ b/chrome/common/sqlite_utils.cc
@@ -4,8 +4,17 @@
#include "chrome/common/sqlite_utils.h"
+#include "base/file_path.h"
#include "base/logging.h"
+int OpenSqliteDb(const FilePath& filepath, sqlite3** database) {
+#if defined(OS_WIN)
+ return sqlite3_open16(filepath.value().c_str(), database);
+#elif defined(OS_POSIX)
+ return sqlite3_open(filepath.value().c_str(), database);
+#endif
+}
+
bool DoesSqliteTableExist(sqlite3* db,
const char* db_name,
const char* table_name) {
@@ -71,7 +80,6 @@ bool DoesSqliteTableHaveRow(sqlite3* db, const char* table_name) {
return s.step() == SQLITE_ROW;
}
-
SQLTransaction::SQLTransaction(sqlite3* db) : db_(db), began_(false) {
}
diff --git a/chrome/common/sqlite_utils.h b/chrome/common/sqlite_utils.h
index fcf384d..f704141 100644
--- a/chrome/common/sqlite_utils.h
+++ b/chrome/common/sqlite_utils.h
@@ -13,6 +13,7 @@
#include "third_party/sqlite/preprocessed/sqlite3.h"
// forward declarations of classes defined here
+class FilePath;
class SQLTransaction;
class SQLNestedTransaction;
class SQLNestedTransactionSite;
@@ -311,6 +312,13 @@ class SQLStatement : public scoped_sqlite3_stmt_ptr {
DISALLOW_COPY_AND_ASSIGN(SQLStatement);
};
+// TODO(estade): wrap the following static functions in a namespace.
+
+// Opens the DB in the file pointed to by |filepath|.
+// See http://www.sqlite.org/capi3ref.html#sqlite3_open for an explanation
+// of the return value.
+int OpenSqliteDb(const FilePath& filepath, sqlite3** database);
+
// Returns true if there is a table with the given name in the database.
// For the version where a database name is specified, it may be NULL or the
// empty string if no database name is necessary.
@@ -321,7 +329,6 @@ inline bool DoesSqliteTableExist(sqlite3* db, const char* table_name) {
return DoesSqliteTableExist(db, NULL, table_name);
}
-
// Test whether a table has a column matching the provided name and type.
// Returns true if the column exist and false otherwise. There are two
// versions, one that takes a database name, the other that doesn't. The