Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: net/url_request/file_protocol_handler.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/file_protocol_handler.h ('k') | net/url_request/ftp_protocol_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/file_protocol_handler.cc
diff --git a/net/url_request/file_protocol_handler.cc b/net/url_request/file_protocol_handler.cc
index ec77772b57e43882a2d24ce3e83a05f6bdbe8a36..0f9f73c82ffa69429002d8177b34a85cdc6d2308 100644
--- a/net/url_request/file_protocol_handler.cc
+++ b/net/url_request/file_protocol_handler.cc
@@ -7,25 +7,24 @@
#include "base/logging.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_dir_job.h"
#include "net/url_request/url_request_file_job.h"
namespace net {
-FileProtocolHandler::FileProtocolHandler(
- NetworkDelegate* network_delegate)
- : network_delegate_(network_delegate) {
-}
+FileProtocolHandler::FileProtocolHandler() { }
-URLRequestJob* FileProtocolHandler::MaybeCreateJob(URLRequest* request) const {
+URLRequestJob* FileProtocolHandler::MaybeCreateJob(
+ URLRequest* request, NetworkDelegate* network_delegate) const {
FilePath file_path;
const bool is_file = FileURLToFilePath(request->url(), &file_path);
// Check file access permissions.
- if (!network_delegate_ ||
- !network_delegate_->CanAccessFile(*request, file_path)) {
- return new URLRequestErrorJob(request, ERR_ACCESS_DENIED);
+ if (!network_delegate ||
+ !network_delegate->CanAccessFile(*request, file_path)) {
+ return new URLRequestErrorJob(request, network_delegate, ERR_ACCESS_DENIED);
}
// We need to decide whether to create URLRequestFileJob for file access or
@@ -37,12 +36,12 @@ URLRequestJob* FileProtocolHandler::MaybeCreateJob(URLRequest* request) const {
if (is_file &&
file_util::EndsWithSeparator(file_path) &&
file_path.IsAbsolute()) {
- return new URLRequestFileDirJob(request, file_path);
+ return new URLRequestFileDirJob(request, network_delegate, file_path);
}
// Use a regular file request job for all non-directories (including invalid
// file names).
- return new URLRequestFileJob(request, file_path, network_delegate_);
+ return new URLRequestFileJob(request, network_delegate, file_path);
}
} // namespace net
« no previous file with comments | « net/url_request/file_protocol_handler.h ('k') | net/url_request/ftp_protocol_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698