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

Side by Side Diff: net/base/filename_util_internal.cc

Issue 1423663012: Removing x-x509-user-cert mime handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix C-D setting. Created 4 years, 11 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
« no previous file with comments | « content/content_browser.gypi ('k') | tools/metrics/histograms/histograms.xml » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base/filename_util.h" 5 #include "net/base/filename_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 HttpContentDisposition header(content_disposition, referrer_charset); 238 HttpContentDisposition header(content_disposition, referrer_charset);
239 filename = header.filename(); 239 filename = header.filename();
240 if (!filename.empty()) 240 if (!filename.empty())
241 is_name_from_content_disposition = true; 241 is_name_from_content_disposition = true;
242 } 242 }
243 243
244 // Then try to use the suggested name. 244 // Then try to use the suggested name.
245 if (filename.empty() && !suggested_name.empty()) 245 if (filename.empty() && !suggested_name.empty())
246 filename = suggested_name; 246 filename = suggested_name;
247 247
248 if (filename.empty() && mime_type == "application/x-x509-user-cert")
249 filename = "user.crt";
asanka 2016/01/11 21:16:34 Let's move this logic to DownloadTargetDeterminer
svaldez 2016/01/11 21:34:55 Done.
250
248 // Now try extracting the filename from the URL. GetFileNameFromURL() only 251 // Now try extracting the filename from the URL. GetFileNameFromURL() only
249 // looks at the last component of the URL and doesn't return the hostname as a 252 // looks at the last component of the URL and doesn't return the hostname as a
250 // failover. 253 // failover.
251 if (filename.empty()) 254 if (filename.empty())
252 filename = GetFileNameFromURL(url, referrer_charset, &overwrite_extension); 255 filename = GetFileNameFromURL(url, referrer_charset, &overwrite_extension);
253 256
254 // Finally try the URL hostname, but only if there's no default specified in 257 // Finally try the URL hostname, but only if there's no default specified in
255 // |default_name|. Some schemes (e.g.: file:, about:, data:) do not have a 258 // |default_name|. Some schemes (e.g.: file:, about:, data:) do not have a
256 // host name. 259 // host name.
257 if (filename.empty() && default_name.empty() && url.is_valid() && 260 if (filename.empty() && default_name.empty() && url.is_valid() &&
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 base::FilePath generated_name( 325 base::FilePath generated_name(
323 base::SysWideToNativeMB(base::UTF16ToWide(file_name))); 326 base::SysWideToNativeMB(base::UTF16ToWide(file_name)));
324 #endif 327 #endif
325 328
326 DCHECK(!generated_name.empty()); 329 DCHECK(!generated_name.empty());
327 330
328 return generated_name; 331 return generated_name;
329 } 332 }
330 333
331 } // namespace net 334 } // namespace net
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698