OLD | NEW |
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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 // See file_path.h for a discussion of the encoding of paths on POSIX | 545 // See file_path.h for a discussion of the encoding of paths on POSIX |
546 // platforms. These encoding conversion functions are not quite correct. | 546 // platforms. These encoding conversion functions are not quite correct. |
547 | 547 |
548 string16 FilePath::LossyDisplayName() const { | 548 string16 FilePath::LossyDisplayName() const { |
549 return WideToUTF16(SysNativeMBToWide(path_)); | 549 return WideToUTF16(SysNativeMBToWide(path_)); |
550 } | 550 } |
551 | 551 |
552 std::string FilePath::MaybeAsASCII() const { | 552 std::string FilePath::MaybeAsASCII() const { |
553 if (IsStringASCII(path_)) | 553 if (IsStringASCII(path_)) |
554 return path_; | 554 return path_; |
555 return ""; | 555 return std::string(); |
556 } | 556 } |
557 | 557 |
558 std::string FilePath::AsUTF8Unsafe() const { | 558 std::string FilePath::AsUTF8Unsafe() const { |
559 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) | 559 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) |
560 return value(); | 560 return value(); |
561 #else | 561 #else |
562 return WideToUTF8(SysNativeMBToWide(value())); | 562 return WideToUTF8(SysNativeMBToWide(value())); |
563 #endif | 563 #endif |
564 } | 564 } |
565 | 565 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 #else | 1251 #else |
1252 return *this; | 1252 return *this; |
1253 #endif | 1253 #endif |
1254 } | 1254 } |
1255 | 1255 |
1256 } // namespace base | 1256 } // namespace base |
1257 | 1257 |
1258 void PrintTo(const base::FilePath& path, std::ostream* out) { | 1258 void PrintTo(const base::FilePath& path, std::ostream* out) { |
1259 *out << path.value(); | 1259 *out << path.value(); |
1260 } | 1260 } |
OLD | NEW |