OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h
" | 5 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h
" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h" | 8 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h" |
9 #include "net/base/escape.h" | 9 #include "net/base/escape.h" |
10 #include "storage/browser/fileapi/file_system_url.h" | 10 #include "storage/browser/fileapi/file_system_url.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 chromeos::ExternalFileURLToVirtualPath(external_file_url); | 40 chromeos::ExternalFileURLToVirtualPath(external_file_url); |
41 base::FilePath path_after_root; | 41 base::FilePath path_after_root; |
42 if (!base::FilePath::FromUTF8Unsafe(kContentFileSystemMountPointName) | 42 if (!base::FilePath::FromUTF8Unsafe(kContentFileSystemMountPointName) |
43 .AppendRelativePath(virtual_path, &path_after_root)) { | 43 .AppendRelativePath(virtual_path, &path_after_root)) { |
44 return GURL(); | 44 return GURL(); |
45 } | 45 } |
46 return UnescapeArcUrl(path_after_root.AsUTF8Unsafe()); | 46 return UnescapeArcUrl(path_after_root.AsUTF8Unsafe()); |
47 } | 47 } |
48 | 48 |
49 GURL FileSystemUrlToArcUrl(const storage::FileSystemURL& url) { | 49 GURL FileSystemUrlToArcUrl(const storage::FileSystemURL& url) { |
| 50 return PathToArcUrl(url.path()); |
| 51 } |
| 52 |
| 53 GURL PathToArcUrl(const base::FilePath& path) { |
50 base::FilePath path_after_mount_point; | 54 base::FilePath path_after_mount_point; |
51 if (!base::FilePath(kContentFileSystemMountPointPath) | 55 if (!base::FilePath(kContentFileSystemMountPointPath) |
52 .AppendRelativePath(url.path(), &path_after_mount_point)) { | 56 .AppendRelativePath(path, &path_after_mount_point)) { |
53 return GURL(); | 57 return GURL(); |
54 } | 58 } |
55 return UnescapeArcUrl(path_after_mount_point.AsUTF8Unsafe()); | 59 return UnescapeArcUrl(path_after_mount_point.AsUTF8Unsafe()); |
56 } | 60 } |
57 | 61 |
58 } // namespace arc | 62 } // namespace arc |
OLD | NEW |