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

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

Issue 15010: Implement extension:// protocol. (Closed)
Patch Set: add missing unit test Created 12 years 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
« no previous file with comments | « net/url_request/url_request_file_job.h ('k') | webkit/tools/test_shell/test_shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // For loading files, we make use of overlapped i/o to ensure that reading from 5 // For loading files, we make use of overlapped i/o to ensure that reading from
6 // the filesystem (e.g., a network filesystem) does not block the calling 6 // the filesystem (e.g., a network filesystem) does not block the calling
7 // thread. An alternative approach would be to use a background thread or pool 7 // thread. An alternative approach would be to use a background thread or pool
8 // of threads, but it seems better to leverage the operating system's ability 8 // of threads, but it seems better to leverage the operating system's ability
9 // to do background file reads for us. 9 // to do background file reads for us.
10 // 10 //
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // static 71 // static
72 URLRequestJob* URLRequestFileJob::Factory( 72 URLRequestJob* URLRequestFileJob::Factory(
73 URLRequest* request, const std::string& scheme) { 73 URLRequest* request, const std::string& scheme) {
74 FilePath file_path; 74 FilePath file_path;
75 if (net::FileURLToFilePath(request->url(), &file_path) && 75 if (net::FileURLToFilePath(request->url(), &file_path) &&
76 file_util::EnsureEndsWithSeparator(&file_path)) 76 file_util::EnsureEndsWithSeparator(&file_path))
77 return new URLRequestFileDirJob(request, file_path); 77 return new URLRequestFileDirJob(request, file_path);
78 78
79 // Use a regular file request job for all non-directories (including invalid 79 // Use a regular file request job for all non-directories (including invalid
80 // file names). 80 // file names).
81 URLRequestFileJob* job = new URLRequestFileJob(request); 81 return new URLRequestFileJob(request, file_path);
82 job->file_path_ = file_path;
83 return job;
84 } 82 }
85 83
86 URLRequestFileJob::URLRequestFileJob(URLRequest* request) 84 URLRequestFileJob::URLRequestFileJob(URLRequest* request,
85 const FilePath& file_path)
87 : URLRequestJob(request), 86 : URLRequestJob(request),
87 file_path_(file_path),
88 ALLOW_THIS_IN_INITIALIZER_LIST( 88 ALLOW_THIS_IN_INITIALIZER_LIST(
89 io_callback_(this, &URLRequestFileJob::DidRead)), 89 io_callback_(this, &URLRequestFileJob::DidRead)),
90 is_directory_(false) { 90 is_directory_(false) {
91 } 91 }
92 92
93 URLRequestFileJob::~URLRequestFileJob() { 93 URLRequestFileJob::~URLRequestFileJob() {
94 #if defined(OS_WIN) 94 #if defined(OS_WIN)
95 DCHECK(!async_resolver_); 95 DCHECK(!async_resolver_);
96 #endif 96 #endif
97 } 97 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return false; 214 return false;
215 215
216 *location = net::FilePathToFileURL(new_path); 216 *location = net::FilePathToFileURL(new_path);
217 *http_status_code = 301; 217 *http_status_code = 301;
218 return true; 218 return true;
219 #else 219 #else
220 return false; 220 return false;
221 #endif 221 #endif
222 } 222 }
223 223
OLDNEW
« no previous file with comments | « net/url_request/url_request_file_job.h ('k') | webkit/tools/test_shell/test_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698