summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 19:07:49 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-10 19:07:49 +0000
commita10cc906886dfd4f68d9ebcdf1611e973354c90b (patch)
treed99eba758a2ffe3692d8a2f8de205ca465b3f11c /net
parent5fa5f68d0674a1029658f7eef6317ccda370492a (diff)
downloadchromium_src-a10cc906886dfd4f68d9ebcdf1611e973354c90b.zip
chromium_src-a10cc906886dfd4f68d9ebcdf1611e973354c90b.tar.gz
chromium_src-a10cc906886dfd4f68d9ebcdf1611e973354c90b.tar.bz2
add file:// handling to mac and linux builds
Review URL: http://codereview.chromium.org/7230 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/SConscript2
-rw-r--r--net/net.xcodeproj/project.pbxproj2
-rw-r--r--net/url_request/url_request_file_job.cc20
-rw-r--r--net/url_request/url_request_job_manager.cc4
4 files changed, 18 insertions, 10 deletions
diff --git a/net/SConscript b/net/SConscript
index b405630..74d64b3 100644
--- a/net/SConscript
+++ b/net/SConscript
@@ -78,6 +78,7 @@ input_files = [
'url_request/url_request.cc',
'url_request/url_request_about_job.cc',
'url_request/url_request_error_job.cc',
+ 'url_request/url_request_file_job.cc',
'url_request/url_request_http_job.cc',
'url_request/url_request_job.cc',
'url_request/url_request_job_metrics.cc',
@@ -108,7 +109,6 @@ if env['PLATFORM'] == 'win32':
'proxy/proxy_resolver_winhttp.cc',
'proxy/proxy_service.cc',
'url_request/url_request_file_dir_job.cc',
- 'url_request/url_request_file_job.cc',
'url_request/url_request_filter.cc',
'url_request/url_request_ftp_job.cc',
'url_request/url_request_inet_job.cc',
diff --git a/net/net.xcodeproj/project.pbxproj b/net/net.xcodeproj/project.pbxproj
index 51ee3d7..15f2211 100644
--- a/net/net.xcodeproj/project.pbxproj
+++ b/net/net.xcodeproj/project.pbxproj
@@ -149,6 +149,7 @@
B5F622260E805FC40076681A /* url_request_job_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED33A30E5A198600A747DB /* url_request_job_manager.cc */; };
BAA46E3B0E5CE99A00E77460 /* net_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED329F0E5A181C00A747DB /* net_util_unittest.cc */; };
DFEE18270E882E3600666107 /* stats_histogram.cc in Sources */ = {isa = PBXBuildFile; fileRef = DFEE18250E882E3600666107 /* stats_histogram.cc */; };
+ E4005E3A0E9FA63B0055B38E /* url_request_file_job.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED33B00E5A198600A747DB /* url_request_file_job.cc */; };
E47E933F0E8924DC00CA613E /* tcp_client_socket_libevent.cc in Sources */ = {isa = PBXBuildFile; fileRef = E47E933E0E8924DC00CA613E /* tcp_client_socket_libevent.cc */; };
E47E93430E8924EE00CA613E /* tcp_client_socket_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BED328E0E5A181C00A747DB /* tcp_client_socket_unittest.cc */; };
E49DD2EA0E892F8C003C7A87 /* sdch_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49DD2E80E892F8C003C7A87 /* sdch_manager.cc */; };
@@ -1473,6 +1474,7 @@
821F23710E5E0F15003C7E38 /* url_request.cc in Sources */,
821F23C30E5E105E003C7E38 /* url_request_about_job.cc in Sources */,
7B85044A0E5B2E9600730B43 /* url_request_error_job.cc in Sources */,
+ E4005E3A0E9FA63B0055B38E /* url_request_file_job.cc in Sources */,
821F236C0E5E0EF8003C7E38 /* url_request_http_job.cc in Sources */,
821F23CA0E5E106B003C7E38 /* url_request_job.cc in Sources */,
B5F622260E805FC40076681A /* url_request_job_manager.cc in Sources */,
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 6139827..de3e6fa 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -28,7 +28,9 @@
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request.h"
+#if defined(OS_WIN)
#include "net/url_request/url_request_file_dir_job.h"
+#endif
#if defined(OS_WIN)
class URLRequestFileJob::AsyncResolver :
@@ -74,8 +76,10 @@ URLRequestJob* URLRequestFileJob::Factory(
std::wstring file_path;
if (net::FileURLToFilePath(request->url(), &file_path)) {
if (file_path[file_path.size() - 1] == file_util::kPathSeparator) {
+#if defined(OS_WIN)
// Only directories have trailing slashes.
return new URLRequestFileDirJob(request, file_path);
+#endif
}
}
@@ -100,20 +104,22 @@ URLRequestFileJob::~URLRequestFileJob() {
}
void URLRequestFileJob::Start() {
+#if defined(OS_WIN)
// Resolve UNC paths on a background thread.
if (!file_path_.compare(0, 2, L"\\\\")) {
DCHECK(!async_resolver_);
async_resolver_ = new AsyncResolver(this);
WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
async_resolver_.get(), &AsyncResolver::Resolve, file_path_), true);
- } else {
- file_util::FileInfo file_info;
- bool exists = file_util::GetFileInfo(file_path_, &file_info);
-
- // Continue asynchronously.
- MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &URLRequestFileJob::DidResolve, exists, file_info));
+ return;
}
+#endif
+ file_util::FileInfo file_info;
+ bool exists = file_util::GetFileInfo(file_path_, &file_info);
+
+ // Continue asynchronously.
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &URLRequestFileJob::DidResolve, exists, file_info));
}
void URLRequestFileJob::Kill() {
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index e4c44e9..3dd7929 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -11,8 +11,8 @@
#include "net/base/load_flags.h"
#include "net/url_request/url_request_about_job.h"
#include "net/url_request/url_request_error_job.h"
-#if defined(OS_WIN)
#include "net/url_request/url_request_file_job.h"
+#if defined(OS_WIN)
#include "net/url_request/url_request_ftp_job.h"
#else
// TODO(playmobil): Implement on non-windows platforms.
@@ -33,8 +33,8 @@ struct SchemeToFactory {
static const SchemeToFactory kBuiltinFactories[] = {
{ "http", URLRequestHttpJob::Factory },
{ "https", URLRequestHttpJob::Factory },
-#if defined(OS_WIN)
{ "file", URLRequestFileJob::Factory },
+#if defined(OS_WIN)
{ "ftp", URLRequestFtpJob::Factory },
#else
// TODO(playmobil): Implement on non-windows platforms.