diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:17:12 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:17:12 +0000 |
commit | 72cbd32707a2ede460bcc1b3cb199e653282a8ed (patch) | |
tree | d212d36fbd064fd4b8c5783a9002f235c98d7a2d /net/url_request | |
parent | 2fe25aac3d317086338a761e3b040cbcffc3a873 (diff) | |
download | chromium_src-72cbd32707a2ede460bcc1b3cb199e653282a8ed.zip chromium_src-72cbd32707a2ede460bcc1b3cb199e653282a8ed.tar.gz chromium_src-72cbd32707a2ede460bcc1b3cb199e653282a8ed.tar.bz2 |
Switching things to FilePath:
Remove following deprecated wstring-using functions:
net/net_util: FilePathToFileURL
net/net_util: FileURLToFilePath
Switch net/base/upload_data to FilePath.
Switch upload-related parts of net/url_request/url_request to FilePath.
Made necessary adjustments in rest of code (a lot).
Review URL: http://codereview.chromium.org/63011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request.h | 5 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.cc | 2 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.cc | 25 |
4 files changed, 19 insertions, 17 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index d6c34f1..acf70dd 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -94,9 +94,9 @@ void URLRequest::AppendBytesToUpload(const char* bytes, int bytes_len) { upload_->AppendBytes(bytes, bytes_len); } -void URLRequest::AppendFileRangeToUpload(const wstring& file_path, +void URLRequest::AppendFileRangeToUpload(const FilePath& file_path, uint64 offset, uint64 length) { - DCHECK(file_path.length() > 0 && length > 0); + DCHECK(file_path.value().length() > 0 && length > 0); if (!upload_) upload_ = new UploadData(); upload_->AppendFileRange(file_path, offset, length); diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index d45e510..a075764 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/file_path.h" #include "base/logging.h" #include "base/ref_counted.h" #include "googleurl/src/gurl.h" @@ -236,9 +237,9 @@ class URLRequest { // When uploading a file range, length must be non-zero. If length // exceeds the end-of-file, the upload is clipped at end-of-file. void AppendBytesToUpload(const char* bytes, int bytes_len); - void AppendFileRangeToUpload(const std::wstring& file_path, + void AppendFileRangeToUpload(const FilePath& file_path, uint64 offset, uint64 length); - void AppendFileToUpload(const std::wstring& file_path) { + void AppendFileToUpload(const FilePath& file_path) { AppendFileRangeToUpload(file_path, 0, kuint64max); } diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index 097169f..db3ff13 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -238,7 +238,7 @@ bool URLRequestFileJob::IsRedirectResponse( if (!resolved) return false; - *location = net::FilePathToFileURL(new_path); + *location = net::FilePathToFileURL(FilePath(new_path)); *http_status_code = 301; return true; #else diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index fbfaafe..372ff43 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -16,6 +16,7 @@ #include <algorithm> #include <string> +#include "base/file_path.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" @@ -526,16 +527,17 @@ TEST_F(URLRequestTest, PostFileTest) { PathService::Get(base::DIR_EXE, &dir); file_util::SetCurrentDirectory(dir); - std::wstring path; + FilePath path; PathService::Get(base::DIR_SOURCE_ROOT, &path); - file_util::AppendToPath(&path, L"net"); - file_util::AppendToPath(&path, L"data"); - file_util::AppendToPath(&path, L"url_request_unittest"); - file_util::AppendToPath(&path, L"with-headers.html"); + path = path.Append(FILE_PATH_LITERAL("net")); + path = path.Append(FILE_PATH_LITERAL("data")); + path = path.Append(FILE_PATH_LITERAL("url_request_unittest")); + path = path.Append(FILE_PATH_LITERAL("with-headers.html")); r.AppendFileToUpload(path); // This file should just be ignored in the upload stream. - r.AppendFileToUpload(L"c:\\path\\to\\non\\existant\\file.randomness.12345"); + r.AppendFileToUpload(FilePath(FILE_PATH_LITERAL( + "c:\\path\\to\\non\\existant\\file.randomness.12345"))); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -586,7 +588,7 @@ TEST_F(URLRequestTest, AboutBlankTest) { TEST_F(URLRequestTest, FileTest) { FilePath app_path; PathService::Get(base::FILE_EXE, &app_path); - GURL app_url = net::FilePathToFileURL(app_path.ToWStringHack()); + GURL app_url = net::FilePathToFileURL(app_path); TestDelegate d; { @@ -760,7 +762,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { TestDelegate d; { - TestURLRequest r(net::FilePathToFileURL(lnk_path), &d); + TestURLRequest r(net::FilePathToFileURL(FilePath(lnk_path)), &d); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -823,11 +825,10 @@ TEST_F(URLRequestTest, FileDirCancelTest) { TestDelegate d; { - std::wstring file_path; + FilePath file_path; PathService::Get(base::DIR_SOURCE_ROOT, &file_path); - file_util::AppendToPath(&file_path, L"net"); - file_util::AppendToPath(&file_path, L"data"); - file_util::AppendToPath(&file_path, L""); + file_path = file_path.Append(FILE_PATH_LITERAL("net")); + file_path = file_path.Append(FILE_PATH_LITERAL("data")); TestURLRequest req(net::FilePathToFileURL(file_path), &d); req.Start(); |