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

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

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « net/base/dir_header.html ('k') | net/base/filename_util_unittest.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 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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // with the preferred extension for the MIME type if one is available. 195 // with the preferred extension for the MIME type if one is available.
196 if (IsShellIntegratedExtension(extension)) 196 if (IsShellIntegratedExtension(extension))
197 extension.assign(default_extension); 197 extension.assign(default_extension);
198 #endif 198 #endif
199 199
200 *file_name = file_name->ReplaceExtension(extension); 200 *file_name = file_name->ReplaceExtension(extension);
201 } 201 }
202 202
203 bool FilePathToString16(const base::FilePath& path, base::string16* converted) { 203 bool FilePathToString16(const base::FilePath& path, base::string16* converted) {
204 #if defined(OS_WIN) 204 #if defined(OS_WIN)
205 return base::WideToUTF16( 205 *converted = path.value();
206 path.value().c_str(), path.value().size(), converted); 206 return true;
207 #elif defined(OS_POSIX) 207 #elif defined(OS_POSIX)
208 std::string component8 = path.AsUTF8Unsafe(); 208 std::string component8 = path.AsUTF8Unsafe();
209 return !component8.empty() && 209 return !component8.empty() &&
210 base::UTF8ToUTF16(component8.c_str(), component8.size(), converted); 210 base::UTF8ToUTF16(component8.c_str(), component8.size(), converted);
211 #endif 211 #endif
212 } 212 }
213 213
214 base::string16 GetSuggestedFilenameImpl( 214 base::string16 GetSuggestedFilenameImpl(
215 const GURL& url, 215 const GURL& url,
216 const std::string& content_disposition, 216 const std::string& content_disposition,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 base::FilePath generated_name( 318 base::FilePath generated_name(
319 base::SysWideToNativeMB(base::UTF16ToWide(file_name))); 319 base::SysWideToNativeMB(base::UTF16ToWide(file_name)));
320 #endif 320 #endif
321 321
322 DCHECK(!generated_name.empty()); 322 DCHECK(!generated_name.empty());
323 323
324 return generated_name; 324 return generated_name;
325 } 325 }
326 326
327 } // namespace net 327 } // namespace net
OLDNEW
« no previous file with comments | « net/base/dir_header.html ('k') | net/base/filename_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698