GN: Move towards only using / on Windows

Remove most of the \ handling code, and start some normalization to /
as necessary. Paths that come from actions, etc. aren't validated yet.

This makes the Windows build get farther, but now it fails
with things similar to:

ninja: Entering directory `out_gn2'
ninja: error: WriteFile(obj/third_party/re2/re2/re2.unicode_groups.obj.rsp): Unable to create file. No such file or directory

Looks like we're not creating the subtree for ninja to write
rsp files to? Not sure.

This removes the last argument from rebase_path, so might have some
migration issues in landing the binary.

R=brettw@chromium.org
BUG=354626

Review URL: https://codereview.chromium.org/213353004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261311 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: ee55eaceea8d7632a59761c603af0f4503db00df
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index d47becb..f5a9e5a 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -1292,10 +1292,16 @@
 }
 
 FilePath FilePath::NormalizePathSeparators() const {
+  return NormalizePathSeparatorsTo(kSeparators[0]);
+}
+
+FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const {
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
+  DCHECK_NE(kSeparators + kSeparatorsLength,
+            std::find(kSeparators, kSeparators + kSeparatorsLength, separator));
   StringType copy = path_;
-  for (size_t i = 1; i < kSeparatorsLength; ++i) {
-    std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]);
+  for (size_t i = 0; i < kSeparatorsLength; ++i) {
+    std::replace(copy.begin(), copy.end(), kSeparators[i], separator);
   }
   return FilePath(copy);
 #else