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_url.h" | 5 #include "webkit/fileapi/file_system_url.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 ss << GetFileSystemTypeString(type_) << "@" << filesystem_id_ << ":"; | 148 ss << GetFileSystemTypeString(type_) << "@" << filesystem_id_ << ":"; |
149 ss << path_.value(); | 149 ss << path_.value(); |
150 ss << ")"; | 150 ss << ")"; |
151 } else { | 151 } else { |
152 ss << path_.value(); | 152 ss << path_.value(); |
153 } | 153 } |
154 return ss.str(); | 154 return ss.str(); |
155 } | 155 } |
156 | 156 |
157 bool FileSystemURL::IsParent(const FileSystemURL& child) const { | 157 bool FileSystemURL::IsParent(const FileSystemURL& child) const { |
158 return origin() == child.origin() && | 158 return IsInSameFileSystem(child) && |
159 type() == child.type() && | |
160 filesystem_id() == child.filesystem_id() && | |
161 path().IsParent(child.path()); | 159 path().IsParent(child.path()); |
162 } | 160 } |
163 | 161 |
| 162 bool FileSystemURL::IsInSameFileSystem(const FileSystemURL& other) const { |
| 163 return origin() == other.origin() && |
| 164 type() == other.type() && |
| 165 filesystem_id() == other.filesystem_id(); |
| 166 } |
| 167 |
164 bool FileSystemURL::operator==(const FileSystemURL& that) const { | 168 bool FileSystemURL::operator==(const FileSystemURL& that) const { |
165 return origin_ == that.origin_ && | 169 return origin_ == that.origin_ && |
166 type_ == that.type_ && | 170 type_ == that.type_ && |
167 path_ == that.path_ && | 171 path_ == that.path_ && |
168 filesystem_id_ == that.filesystem_id_ && | 172 filesystem_id_ == that.filesystem_id_ && |
169 is_valid_ == that.is_valid_; | 173 is_valid_ == that.is_valid_; |
170 } | 174 } |
171 | 175 |
172 bool FileSystemURL::Comparator::operator()(const FileSystemURL& lhs, | 176 bool FileSystemURL::Comparator::operator()(const FileSystemURL& lhs, |
173 const FileSystemURL& rhs) const { | 177 const FileSystemURL& rhs) const { |
174 DCHECK(lhs.is_valid_ && rhs.is_valid_); | 178 DCHECK(lhs.is_valid_ && rhs.is_valid_); |
175 if (lhs.origin_ != rhs.origin_) | 179 if (lhs.origin_ != rhs.origin_) |
176 return lhs.origin_ < rhs.origin_; | 180 return lhs.origin_ < rhs.origin_; |
177 if (lhs.type_ != rhs.type_) | 181 if (lhs.type_ != rhs.type_) |
178 return lhs.type_ < rhs.type_; | 182 return lhs.type_ < rhs.type_; |
179 if (lhs.filesystem_id_ != rhs.filesystem_id_) | 183 if (lhs.filesystem_id_ != rhs.filesystem_id_) |
180 return lhs.filesystem_id_ < rhs.filesystem_id_; | 184 return lhs.filesystem_id_ < rhs.filesystem_id_; |
181 return lhs.path_ < rhs.path_; | 185 return lhs.path_ < rhs.path_; |
182 } | 186 } |
183 | 187 |
184 } // namespace fileapi | 188 } // namespace fileapi |
OLD | NEW |