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

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

Issue 1172753003: Move LowerCaseEqualsASCII to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util
Patch Set: Created 5 years, 6 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
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 // 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 replacements.SetPathStr(new_path); 133 replacements.SetPathStr(new_path);
134 134
135 *location = request_->url().ReplaceComponents(replacements); 135 *location = request_->url().ReplaceComponents(replacements);
136 *http_status_code = 301; // simulate a permanent redirect 136 *http_status_code = 301; // simulate a permanent redirect
137 return true; 137 return true;
138 } 138 }
139 139
140 #if defined(OS_WIN) 140 #if defined(OS_WIN)
141 // Follow a Windows shortcut. 141 // Follow a Windows shortcut.
142 // We just resolve .lnk file, ignore others. 142 // We just resolve .lnk file, ignore others.
143 if (!LowerCaseEqualsASCII(file_path_.Extension(), ".lnk")) 143 if (!base::LowerCaseEqualsASCII(file_path_.Extension(), ".lnk"))
144 return false; 144 return false;
145 145
146 base::FilePath new_path = file_path_; 146 base::FilePath new_path = file_path_;
147 bool resolved; 147 bool resolved;
148 resolved = base::win::ResolveShortcut(new_path, &new_path, NULL); 148 resolved = base::win::ResolveShortcut(new_path, &new_path, NULL);
149 149
150 // If shortcut is not resolved succesfully, do not redirect. 150 // If shortcut is not resolved succesfully, do not redirect.
151 if (!resolved) 151 if (!resolved)
152 return false; 152 return false;
153 153
154 *location = FilePathToFileURL(new_path); 154 *location = FilePathToFileURL(new_path);
155 *http_status_code = 301; 155 *http_status_code = 301;
156 return true; 156 return true;
157 #else 157 #else
158 return false; 158 return false;
159 #endif 159 #endif
160 } 160 }
161 161
162 Filter* URLRequestFileJob::SetupFilter() const { 162 Filter* URLRequestFileJob::SetupFilter() const {
163 // Bug 9936 - .svgz files needs to be decompressed. 163 // Bug 9936 - .svgz files needs to be decompressed.
164 return LowerCaseEqualsASCII(file_path_.Extension(), ".svgz") 164 return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")
165 ? Filter::GZipFactory() : NULL; 165 ? Filter::GZipFactory()
166 : NULL;
166 } 167 }
167 168
168 bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { 169 bool URLRequestFileJob::GetMimeType(std::string* mime_type) const {
169 DCHECK(request_); 170 DCHECK(request_);
170 if (meta_info_.mime_type_result) { 171 if (meta_info_.mime_type_result) {
171 *mime_type = meta_info_.mime_type; 172 *mime_type = meta_info_.mime_type;
172 return true; 173 return true;
173 } 174 }
174 return false; 175 return false;
175 } 176 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if (result == 0) { 308 if (result == 0) {
308 NotifyDone(URLRequestStatus()); 309 NotifyDone(URLRequestStatus());
309 } else if (result < 0) { 310 } else if (result < 0) {
310 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 311 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
311 } 312 }
312 313
313 NotifyReadComplete(result); 314 NotifyReadComplete(result);
314 } 315 }
315 316
316 } // namespace net 317 } // namespace net
OLDNEW
« no previous file with comments | « net/test/url_request/url_request_slow_download_job.cc ('k') | net/url_request/url_request_job_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698