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

Unified Diff: base/files/file_path.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/files/file_path.h ('k') | base/files/file_path_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path.cc
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index de8927ac5b27c2b70a4117e243181be6c55860f1..5b8a60751d53f1c94281617fcfed2b83e9948276 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -23,9 +23,7 @@
#include "base/third_party/icu/icu_utf.h"
#endif
-#if defined(OS_WIN)
-#include <windows.h>
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
#include <CoreFoundation/CoreFoundation.h>
#endif
@@ -421,11 +419,7 @@ FilePath FilePath::InsertBeforeExtension(const StringType& suffix) const {
FilePath FilePath::InsertBeforeExtensionASCII(const StringPiece& suffix)
const {
DCHECK(IsStringASCII(suffix));
-#if defined(OS_WIN)
- return InsertBeforeExtension(ASCIIToUTF16(suffix.as_string()));
-#elif defined(OS_POSIX)
return InsertBeforeExtension(suffix.as_string());
-#endif
}
FilePath FilePath::AddExtension(const StringType& extension) const {
@@ -522,11 +516,7 @@ FilePath FilePath::Append(const FilePath& component) const {
FilePath FilePath::AppendASCII(const StringPiece& component) const {
DCHECK(base::IsStringASCII(component));
-#if defined(OS_WIN)
- return Append(ASCIIToUTF16(component.as_string()));
-#elif defined(OS_POSIX)
return Append(component.as_string());
-#endif
}
bool FilePath::IsAbsolute() const {
@@ -626,52 +616,15 @@ FilePath FilePath::FromUTF16Unsafe(const string16& utf16) {
#endif
}
-#elif defined(OS_WIN)
-string16 FilePath::LossyDisplayName() const {
- return path_;
-}
-
-std::string FilePath::MaybeAsASCII() const {
- if (base::IsStringASCII(path_))
- return UTF16ToASCII(path_);
- return std::string();
-}
-
-std::string FilePath::AsUTF8Unsafe() const {
- return WideToUTF8(value());
-}
-
-string16 FilePath::AsUTF16Unsafe() const {
- return value();
-}
-
-// static
-FilePath FilePath::FromUTF8Unsafe(const std::string& utf8) {
- return FilePath(UTF8ToWide(utf8));
-}
-
-// static
-FilePath FilePath::FromUTF16Unsafe(const string16& utf16) {
- return FilePath(utf16);
-}
#endif
void FilePath::WriteToPickle(Pickle* pickle) const {
-#if defined(OS_WIN)
- pickle->WriteString16(path_);
-#else
pickle->WriteString(path_);
-#endif
}
bool FilePath::ReadFromPickle(PickleIterator* iter) {
-#if defined(OS_WIN)
- if (!iter->ReadString16(&path_))
- return false;
-#else
if (!iter->ReadString(&path_))
return false;
-#endif
if (path_.find(kStringTerminator) != StringType::npos)
return false;
@@ -679,36 +632,7 @@ bool FilePath::ReadFromPickle(PickleIterator* iter) {
return true;
}
-#if defined(OS_WIN)
-// Windows specific implementation of file string comparisons
-
-int FilePath::CompareIgnoreCase(const StringType& string1,
- const StringType& string2) {
- // Perform character-wise upper case comparison rather than using the
- // fully Unicode-aware CompareString(). For details see:
- // http://blogs.msdn.com/michkap/archive/2005/10/17/481600.aspx
- StringType::const_iterator i1 = string1.begin();
- StringType::const_iterator i2 = string2.begin();
- StringType::const_iterator string1end = string1.end();
- StringType::const_iterator string2end = string2.end();
- for ( ; i1 != string1end && i2 != string2end; ++i1, ++i2) {
- wchar_t c1 =
- (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0)));
- wchar_t c2 =
- (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0)));
- if (c1 < c2)
- return -1;
- if (c1 > c2)
- return 1;
- }
- if (i1 != string1end)
- return 1;
- if (i2 != string2end)
- return -1;
- return 0;
-}
-
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
// Mac OS X specific implementation of file string comparisons
// cf. http://developer.apple.com/mac/library/technotes/tn/tn1150.html#UnicodeSubtleties
« no previous file with comments | « base/files/file_path.h ('k') | base/files/file_path_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698