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

Side by Side Diff: net/url_request/file_protocol_handler.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/file_protocol_handler.h" 5 #include "net/url_request/file_protocol_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
(...skipping 16 matching lines...) Expand all
27 return new URLRequestErrorJob(request, network_delegate, ERR_ACCESS_DENIED); 27 return new URLRequestErrorJob(request, network_delegate, ERR_ACCESS_DENIED);
28 } 28 }
29 29
30 // We need to decide whether to create URLRequestFileJob for file access or 30 // We need to decide whether to create URLRequestFileJob for file access or
31 // URLRequestFileDirJob for directory access. To avoid accessing the 31 // URLRequestFileDirJob for directory access. To avoid accessing the
32 // filesystem, we only look at the path string here. 32 // filesystem, we only look at the path string here.
33 // The code in the URLRequestFileJob::Start() method discovers that a path, 33 // The code in the URLRequestFileJob::Start() method discovers that a path,
34 // which doesn't end with a slash, should really be treated as a directory, 34 // which doesn't end with a slash, should really be treated as a directory,
35 // and it then redirects to the URLRequestFileDirJob. 35 // and it then redirects to the URLRequestFileDirJob.
36 if (is_file && 36 if (is_file &&
37 file_util::EndsWithSeparator(file_path) && 37 file_path.EndsWithSeparator() &&
38 file_path.IsAbsolute()) { 38 file_path.IsAbsolute()) {
39 return new URLRequestFileDirJob(request, network_delegate, file_path); 39 return new URLRequestFileDirJob(request, network_delegate, file_path);
40 } 40 }
41 41
42 // Use a regular file request job for all non-directories (including invalid 42 // Use a regular file request job for all non-directories (including invalid
43 // file names). 43 // file names).
44 return new URLRequestFileJob(request, network_delegate, file_path); 44 return new URLRequestFileJob(request, network_delegate, file_path);
45 } 45 }
46 46
47 } // namespace net 47 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698