Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.cc

Issue 2450713002: arc: Register ARC content file system (Closed)
Patch Set: Address comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
11 namespace arc { 11 namespace arc {
12 12
13 namespace {
14
15 const char kMountPointName[] = "arc-content"; 13 const char kMountPointName[] = "arc-content";
16 14
17 } // namespace 15 const base::FilePath::CharType kMountPointPath[] =
16 FILE_PATH_LITERAL("/special/arc-content");
18 17
19 GURL ArcUrlToExternalFileUrl(const GURL& arc_url) { 18 GURL ArcUrlToExternalFileUrl(const GURL& arc_url) {
20 // Return "externalfile:arc-content/<|arc_url| escaped>". 19 // Return "externalfile:arc-content/<|arc_url| escaped>".
21 base::FilePath virtual_path = 20 base::FilePath virtual_path =
22 base::FilePath::FromUTF8Unsafe(kMountPointName) 21 base::FilePath::FromUTF8Unsafe(kMountPointName)
23 .Append(base::FilePath::FromUTF8Unsafe( 22 .Append(base::FilePath::FromUTF8Unsafe(
24 net::EscapeQueryParamValue(arc_url.spec(), false))); 23 net::EscapeQueryParamValue(arc_url.spec(), false)));
25 return chromeos::VirtualPathToExternalFileURL(virtual_path); 24 return chromeos::VirtualPathToExternalFileURL(virtual_path);
26 } 25 }
27 26
28 GURL ExternalFileUrlToArcUrl(const GURL& external_file_url) { 27 GURL ExternalFileUrlToArcUrl(const GURL& external_file_url) {
29 base::FilePath virtual_path = 28 base::FilePath virtual_path =
30 chromeos::ExternalFileURLToVirtualPath(external_file_url); 29 chromeos::ExternalFileURLToVirtualPath(external_file_url);
31 base::FilePath path_after_root; 30 base::FilePath path_after_root;
32 if (!base::FilePath::FromUTF8Unsafe(kMountPointName) 31 if (!base::FilePath::FromUTF8Unsafe(kMountPointName)
33 .AppendRelativePath(virtual_path, &path_after_root)) { 32 .AppendRelativePath(virtual_path, &path_after_root)) {
34 return GURL(); 33 return GURL();
35 } 34 }
36 return GURL(net::UnescapeURLComponent( 35 return GURL(net::UnescapeURLComponent(
37 path_after_root.AsUTF8Unsafe(), 36 path_after_root.AsUTF8Unsafe(),
38 net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS | 37 net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS |
39 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS)); 38 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS));
40 } 39 }
41 40
42 } // namespace arc 41 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698