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 "webkit/fileapi/file_system_types.h" | 7 #include "webkit/fileapi/file_system_types.h" |
8 #include "webkit/fileapi/file_system_util.h" | 8 #include "webkit/fileapi/file_system_util.h" |
9 #include "webkit/fileapi/isolated_context.h" | 9 #include "webkit/fileapi/isolated_context.h" |
10 | 10 |
11 namespace fileapi { | 11 namespace fileapi { |
12 | 12 |
13 FileSystemURL::FileSystemURL() | 13 FileSystemURL::FileSystemURL() |
14 : type_(kFileSystemTypeUnknown), | 14 : type_(kFileSystemTypeUnknown), |
15 mount_type_(kFileSystemMountTypeUnknown), | |
16 is_valid_(false) {} | 15 is_valid_(false) {} |
17 | 16 |
18 FileSystemURL::FileSystemURL(const GURL& url) | 17 FileSystemURL::FileSystemURL(const GURL& url) |
19 : type_(kFileSystemTypeUnknown), | 18 : type_(kFileSystemTypeUnknown) { |
20 mount_type_(kFileSystemMountTypeUnknown) { | |
21 is_valid_ = CrackFileSystemURL(url, &origin_, &type_, &virtual_path_); | 19 is_valid_ = CrackFileSystemURL(url, &origin_, &type_, &virtual_path_); |
22 MayCrackIsolatedPath(); | 20 MayCrackIsolatedPath(); |
23 } | 21 } |
24 | 22 |
25 FileSystemURL::FileSystemURL( | 23 FileSystemURL::FileSystemURL( |
26 const GURL& origin, | 24 const GURL& origin, |
27 FileSystemType type, | 25 FileSystemType type, |
28 const FilePath& path) | 26 const FilePath& path) |
29 : origin_(origin), | 27 : origin_(origin), |
30 type_(type), | 28 type_(type), |
(...skipping 19 matching lines...) Expand all Loading... |
50 return origin_ == that.origin_ && | 48 return origin_ == that.origin_ && |
51 type_ == that.type_ && | 49 type_ == that.type_ && |
52 path_ == that.path_ && | 50 path_ == that.path_ && |
53 virtual_path_ == that.virtual_path_ && | 51 virtual_path_ == that.virtual_path_ && |
54 filesystem_id_ == that.filesystem_id_ && | 52 filesystem_id_ == that.filesystem_id_ && |
55 is_valid_ == that.is_valid_; | 53 is_valid_ == that.is_valid_; |
56 } | 54 } |
57 | 55 |
58 void FileSystemURL::MayCrackIsolatedPath() { | 56 void FileSystemURL::MayCrackIsolatedPath() { |
59 path_ = virtual_path_; | 57 path_ = virtual_path_; |
| 58 mount_type_ = type_; |
60 if (is_valid_ && IsolatedContext::IsIsolatedType(type_)) { | 59 if (is_valid_ && IsolatedContext::IsIsolatedType(type_)) { |
61 mount_type_ = static_cast<FileSystemMountType>(type_); | |
62 // If the type is isolated, crack the path further to get the 'real' | 60 // If the type is isolated, crack the path further to get the 'real' |
63 // filesystem type and path. | 61 // filesystem type and path. |
64 is_valid_ = IsolatedContext::GetInstance()->CrackIsolatedPath( | 62 is_valid_ = IsolatedContext::GetInstance()->CrackIsolatedPath( |
65 virtual_path_, &filesystem_id_, &type_, &path_); | 63 virtual_path_, &filesystem_id_, &type_, &path_); |
66 } | 64 } |
67 } | 65 } |
68 | 66 |
69 } // namespace fileapi | 67 } // namespace fileapi |
OLD | NEW |