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_documents_provider_util.h" | 5 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" |
| 11 #include "net/base/escape.h" |
10 #include "storage/browser/fileapi/file_system_url.h" | 12 #include "storage/browser/fileapi/file_system_url.h" |
| 13 #include "url/gurl.h" |
11 | 14 |
12 namespace arc { | 15 namespace arc { |
13 | 16 |
14 const char kDocumentsProviderMountPointName[] = "arc-documents-provider"; | 17 const char kDocumentsProviderMountPointName[] = "arc-documents-provider"; |
15 const base::FilePath::CharType kDocumentsProviderMountPointPath[] = | 18 const base::FilePath::CharType kDocumentsProviderMountPointPath[] = |
16 "/special/arc-documents-provider"; | 19 "/special/arc-documents-provider"; |
17 const char kAndroidDirectoryMimeType[] = "vnd.android.document/directory"; | 20 const char kAndroidDirectoryMimeType[] = "vnd.android.document/directory"; |
18 | 21 |
19 bool ParseDocumentsProviderUrl(const storage::FileSystemURL& url, | 22 bool ParseDocumentsProviderUrl(const storage::FileSystemURL& url, |
20 std::string* authority, | 23 std::string* authority, |
(...skipping 24 matching lines...) Expand all Loading... |
45 // Special case: AppendRelativePath() fails for identical paths. | 48 // Special case: AppendRelativePath() fails for identical paths. |
46 if (url_path_stripped == root_path) { | 49 if (url_path_stripped == root_path) { |
47 path->clear(); | 50 path->clear(); |
48 } else { | 51 } else { |
49 bool success = root_path.AppendRelativePath(url_path_stripped, path); | 52 bool success = root_path.AppendRelativePath(url_path_stripped, path); |
50 DCHECK(success); | 53 DCHECK(success); |
51 } | 54 } |
52 return true; | 55 return true; |
53 } | 56 } |
54 | 57 |
| 58 GURL BuildDocumentUrl(const std::string& authority, |
| 59 const std::string& document_id) { |
| 60 return GURL(base::StringPrintf( |
| 61 "content://%s/document/%s", |
| 62 net::EscapeQueryParamValue(authority, false /* use_plus */).c_str(), |
| 63 net::EscapeQueryParamValue(document_id, false /* use_plus */).c_str())); |
| 64 } |
| 65 |
55 } // namespace arc | 66 } // namespace arc |
OLD | NEW |