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

Side by Side Diff: base/files/file_path.h

Issue 1686263008: Add utility method for WebString to base::FilePath conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase! Created 4 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 | « no previous file | base/files/file_path.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) 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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 string16 AsUTF16Unsafe() const; 366 string16 AsUTF16Unsafe() const;
367 367
368 // Returns a FilePath object from a path name in UTF-8. This function 368 // Returns a FilePath object from a path name in UTF-8. This function
369 // should only be used for cases where you are sure that the input 369 // should only be used for cases where you are sure that the input
370 // string is UTF-8. 370 // string is UTF-8.
371 // 371 //
372 // Like AsUTF8Unsafe(), this function is unsafe. This function 372 // Like AsUTF8Unsafe(), this function is unsafe. This function
373 // internally calls SysWideToNativeMB() on POSIX systems other than Mac 373 // internally calls SysWideToNativeMB() on POSIX systems other than Mac
374 // and Chrome OS, to mitigate the encoding issue. See the comment at 374 // and Chrome OS, to mitigate the encoding issue. See the comment at
375 // AsUTF8Unsafe() for details. 375 // AsUTF8Unsafe() for details.
376 static FilePath FromUTF8Unsafe(const std::string& utf8); 376 static FilePath FromUTF8Unsafe(StringPiece utf8);
377 377
378 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead. 378 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead.
379 static FilePath FromUTF16Unsafe(const string16& utf16); 379 static FilePath FromUTF16Unsafe(StringPiece16 utf16);
380 380
381 void GetSizeForPickle(PickleSizer* sizer) const; 381 void GetSizeForPickle(PickleSizer* sizer) const;
382 void WriteToPickle(Pickle* pickle) const; 382 void WriteToPickle(Pickle* pickle) const;
383 bool ReadFromPickle(PickleIterator* iter); 383 bool ReadFromPickle(PickleIterator* iter);
384 384
385 // Normalize all path separators to backslash on Windows 385 // Normalize all path separators to backslash on Windows
386 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. 386 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems.
387 FilePath NormalizePathSeparators() const; 387 FilePath NormalizePathSeparators() const;
388 388
389 // Normalize all path separattors to given type on Windows 389 // Normalize all path separattors to given type on Windows
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 template<> 470 template<>
471 struct hash<base::FilePath> { 471 struct hash<base::FilePath> {
472 size_t operator()(const base::FilePath& f) const { 472 size_t operator()(const base::FilePath& f) const {
473 return hash<base::FilePath::StringType>()(f.value()); 473 return hash<base::FilePath::StringType>()(f.value());
474 } 474 }
475 }; 475 };
476 476
477 } // namespace BASE_HASH_NAMESPACE 477 } // namespace BASE_HASH_NAMESPACE
478 478
479 #endif // BASE_FILES_FILE_PATH_H_ 479 #endif // BASE_FILES_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698