| 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 "webkit/fileapi/file_system_util.h" | 5 #include "webkit/fileapi/file_system_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 components->push_back(component); | 103 components->push_back(component); |
| 104 begin = end + 1; | 104 begin = end + 1; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 base::FilePath::StringType VirtualPath::GetNormalizedFilePath( | 108 base::FilePath::StringType VirtualPath::GetNormalizedFilePath( |
| 109 const base::FilePath& path) { | 109 const base::FilePath& path) { |
| 110 base::FilePath::StringType normalized_path = path.value(); | 110 base::FilePath::StringType normalized_path = path.value(); |
| 111 const size_t num_separators = base::FilePath::StringType( | 111 const size_t num_separators = base::FilePath::StringType( |
| 112 base::FilePath::kSeparators).length(); | 112 base::FilePath::kSeparators).length(); |
| 113 for (size_t i = 1; i < num_separators; ++i) { | 113 for (size_t i = 0; i < num_separators; ++i) { |
| 114 std::replace(normalized_path.begin(), normalized_path.end(), | 114 std::replace(normalized_path.begin(), normalized_path.end(), |
| 115 base::FilePath::kSeparators[i], kSeparator); | 115 base::FilePath::kSeparators[i], kSeparator); |
| 116 } | 116 } |
| 117 | 117 |
| 118 return (IsAbsolute(normalized_path)) ? | 118 return (IsAbsolute(normalized_path)) ? |
| 119 normalized_path : base::FilePath::StringType(kRoot) + normalized_path; | 119 normalized_path : base::FilePath::StringType(kRoot) + normalized_path; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool VirtualPath::IsAbsolute(const base::FilePath::StringType& path) { | 122 bool VirtualPath::IsAbsolute(const base::FilePath::StringType& path) { |
| 123 return path.find(kRoot) == 0; | 123 return path.find(kRoot) == 0; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 root.append("/"); | 374 root.append("/"); |
| 375 } | 375 } |
| 376 return root; | 376 return root; |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) { | 379 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) { |
| 380 return url1.origin() == url2.origin() && url1.type() == url2.type(); | 380 return url1.origin() == url2.origin() && url1.type() == url2.type(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace fileapi | 383 } // namespace fileapi |
| OLD | NEW |