summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_file_job.cc15
-rw-r--r--net/url_request/url_request_file_job.h2
2 files changed, 7 insertions, 10 deletions
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 610cda6..c396049 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -89,9 +89,11 @@ URLRequestJob* URLRequestFileJob::Factory(
FilePath file_path;
net::FileURLToFilePath(request->url(), &file_path);
+#if defined(OS_CHROMEOS)
// Check file access.
if (AccessDisabled(file_path))
return new URLRequestErrorJob(request, net::ERR_ACCESS_DENIED);
+#endif
// We need to decide whether to create URLRequestFileJob for file access or
// URLRequestFileDirJob for directory access. To avoid accessing the
@@ -353,25 +355,18 @@ static const char* const kLocalAccessWhiteList[] = {
"/tmp",
"/var/log",
};
-#endif
// static
bool URLRequestFileJob::AccessDisabled(const FilePath& file_path) {
- bool disable = false;
-
-#if defined(OS_CHROMEOS)
- disable = true;
for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) {
const FilePath white_listed_path(kLocalAccessWhiteList[i]);
// FilePath::operator== should probably handle trailing seperators.
if (white_listed_path == file_path.StripTrailingSeparators() ||
white_listed_path.IsParent(file_path)) {
- disable = false;
- break;
+ return false;
}
}
-#endif
-
- return disable;
+ return true;
}
+#endif
diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h
index e2979ee..4a0a191 100644
--- a/net/url_request/url_request_file_job.h
+++ b/net/url_request/url_request_file_job.h
@@ -45,7 +45,9 @@ class URLRequestFileJob : public URLRequestJob {
private:
void DidResolve(bool exists, const base::PlatformFileInfo& file_info);
void DidRead(int result);
+#if defined(OS_CHROMEOS)
static bool AccessDisabled(const FilePath& file_path);
+#endif
net::CompletionCallbackImpl<URLRequestFileJob> io_callback_;
net::FileStream stream_;