summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 23:31:41 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 23:31:41 +0000
commit7ae7c2cbd38f886f4056fa7434a6c1189d98ffd2 (patch)
treee606471e20eb79fea7a05c9005869065bf865ca1 /chrome/browser/history
parentcab465ccf2a93d84e0f16987d8754ac2673eb118 (diff)
downloadchromium_src-7ae7c2cbd38f886f4056fa7434a6c1189d98ffd2.zip
chromium_src-7ae7c2cbd38f886f4056fa7434a6c1189d98ffd2.tar.gz
chromium_src-7ae7c2cbd38f886f4056fa7434a6c1189d98ffd2.tar.bz2
Convert download manager to FilePath.
(Fixed up version of issue 17032. Now passes all unit tests.) Review URL: http://codereview.chromium.org/16533 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/download_database.cc5
-rw-r--r--chrome/browser/history/download_types.h9
-rw-r--r--chrome/browser/history/history_unittest.cc4
3 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc
index f1dcbce..d6f77b6 100644
--- a/chrome/browser/history/download_database.cc
+++ b/chrome/browser/history/download_database.cc
@@ -69,7 +69,8 @@ void DownloadDatabase::QueryDownloads(std::vector<DownloadCreateInfo>* results)
while (statement->step() == SQLITE_ROW) {
DownloadCreateInfo info;
info.db_handle = statement->column_int64(0);
- statement->column_string16(1, &info.path);
+ std::wstring path_str = info.path.ToWStringHack();
+ statement->column_string16(1, &path_str);
statement->column_string16(2, &info.url);
info.start_time = Time::FromTimeT(statement->column_int64(3));
info.received_bytes = statement->column_int64(4);
@@ -117,7 +118,7 @@ int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) {
if (!statement.is_valid())
return 0;
- statement->bind_wstring(0, info.path);
+ statement->bind_wstring(0, info.path.ToWStringHack());
statement->bind_wstring(1, info.url);
statement->bind_int64(2, info.start_time.ToTimeT());
statement->bind_int64(3, info.received_bytes);
diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h
index 61a6d83..e520ff6 100644
--- a/chrome/browser/history/download_types.h
+++ b/chrome/browser/history/download_types.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/time.h"
// Used for informing the download database of a new download, where we don't
@@ -18,7 +19,7 @@
// vector of these structs for passing us the state of all downloads at
// initialization time (see DownloadQueryInfo below).
struct DownloadCreateInfo {
- DownloadCreateInfo(const std::wstring& path,
+ DownloadCreateInfo(const FilePath& path,
const std::wstring& url,
base::Time start_time,
int64 received_bytes,
@@ -44,9 +45,9 @@ struct DownloadCreateInfo {
DownloadCreateInfo() : download_id(-1) {}
// DownloadItem fields
- std::wstring path;
+ FilePath path;
std::wstring url;
- std::wstring suggested_path;
+ FilePath suggested_path;
// A number that should be added to the suggested path to make it unique.
// 0 means no number should be appended. Not actually stored in the db.
int path_uniquifier;
@@ -65,7 +66,7 @@ struct DownloadCreateInfo {
// Whether this download is potentially dangerous (ex: exe, dll, ...).
bool is_dangerous;
// The original name for a dangerous download.
- std::wstring original_name;
+ FilePath original_name;
};
#endif // CHROME_BROWSER_DOWNLOAD_TYPES_H__
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc
index 11b58b0..2f10adb 100644
--- a/chrome/browser/history/history_unittest.cc
+++ b/chrome/browser/history/history_unittest.cc
@@ -193,8 +193,8 @@ class HistoryTest : public testing::Test {
}
int64 AddDownload(int32 state, const Time& time) {
- DownloadCreateInfo download(L"foo-path", L"foo-url", time,
- 0, 512, state, 0);
+ DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")),
+ L"foo-url", time, 0, 512, state, 0);
return db_->CreateDownload(download);
}