Chromium Code Reviews| 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 | 11 |
| 11 namespace arc { | 12 namespace arc { |
| 12 | 13 |
| 13 const char kMountPointName[] = "arc-content"; | 14 const char kMountPointName[] = "arc-content"; |
| 14 | 15 |
| 15 const base::FilePath::CharType kMountPointPath[] = | 16 const base::FilePath::CharType kMountPointPath[] = |
| 16 FILE_PATH_LITERAL("/special/arc-content"); | 17 FILE_PATH_LITERAL("/special/arc-content"); |
| 17 | 18 |
| 18 GURL ArcUrlToExternalFileUrl(const GURL& arc_url) { | 19 GURL ArcUrlToExternalFileUrl(const GURL& arc_url) { |
| 19 // Return "externalfile:arc-content/<|arc_url| escaped>". | 20 // Return "externalfile:arc-content/<|arc_url| escaped>". |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 31 if (!base::FilePath::FromUTF8Unsafe(kMountPointName) | 32 if (!base::FilePath::FromUTF8Unsafe(kMountPointName) |
| 32 .AppendRelativePath(virtual_path, &path_after_root)) { | 33 .AppendRelativePath(virtual_path, &path_after_root)) { |
| 33 return GURL(); | 34 return GURL(); |
| 34 } | 35 } |
| 35 return GURL(net::UnescapeURLComponent( | 36 return GURL(net::UnescapeURLComponent( |
| 36 path_after_root.AsUTF8Unsafe(), | 37 path_after_root.AsUTF8Unsafe(), |
| 37 net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS | | 38 net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS | |
| 38 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS)); | 39 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS)); |
| 39 } | 40 } |
| 40 | 41 |
| 42 GURL FileSystemUrlToArcUrl(const storage::FileSystemURL& url) { | |
|
hidehiko
2016/11/04 17:19:49
Could you share the "path_after_root" and later co
hashimoto
2016/11/07 05:34:15
You mean sharing the code with ExternalFileUrlToAr
hidehiko
2016/11/07 18:07:54
My question was;
Why FileSystemUrlToArcUrl passes
hashimoto
2016/11/08 01:34:16
That makes sense.
Done.
| |
| 43 base::FilePath virtual_path = base::FilePath::FromUTF8Unsafe(kMountPointName); | |
| 44 if (!base::FilePath(kMountPointPath) | |
| 45 .AppendRelativePath(url.path(), &virtual_path)) { | |
| 46 return GURL(); | |
| 47 } | |
| 48 return ExternalFileUrlToArcUrl( | |
| 49 chromeos::VirtualPathToExternalFileURL(virtual_path)); | |
| 50 } | |
| 51 | |
| 41 } // namespace arc | 52 } // namespace arc |
| OLD | NEW |