OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fileapi/file_system_backend.h" | 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" | |
14 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" | 15 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" |
15 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" | 16 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" |
16 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 17 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
19 #include "chromeos/dbus/cros_disks_client.h" | 20 #include "chromeos/dbus/cros_disks_client.h" |
20 #include "storage/browser/fileapi/async_file_util.h" | 21 #include "storage/browser/fileapi/async_file_util.h" |
21 #include "storage/browser/fileapi/external_mount_points.h" | 22 #include "storage/browser/fileapi/external_mount_points.h" |
22 #include "storage/browser/fileapi/file_stream_reader.h" | 23 #include "storage/browser/fileapi/file_stream_reader.h" |
23 #include "storage/browser/fileapi/file_stream_writer.h" | 24 #include "storage/browser/fileapi/file_stream_writer.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 if (components.size() < 2) { | 150 if (components.size() < 2) { |
150 // Unable to access /archive and /removable directories directly. The | 151 // Unable to access /archive and /removable directories directly. The |
151 // inner mount name must be specified. | 152 // inner mount name must be specified. |
152 callback.Run( | 153 callback.Run( |
153 GURL(root_url), std::string(), base::File::FILE_ERROR_SECURITY); | 154 GURL(root_url), std::string(), base::File::FILE_ERROR_SECURITY); |
154 return; | 155 return; |
155 } | 156 } |
156 std::string inner_mount_name = components[1]; | 157 std::string inner_mount_name = components[1]; |
157 root_url += inner_mount_name + "/"; | 158 root_url += inner_mount_name + "/"; |
158 name = inner_mount_name; | 159 name = inner_mount_name; |
160 } else if (id == arc::kDocumentsProviderMountPointName) { | |
161 // For ARC documents provider file system, volumes are mounted per document | |
162 // provider root, so we need to fix up |root_url| to point to an individual | |
163 // root. | |
164 std::string authority; | |
165 std::string root_document_id; | |
166 base::FilePath unused_path; | |
167 if (!arc::ParseDocumentsProviderUrl(url, &authority, &root_document_id, | |
168 &unused_path)) { | |
169 callback.Run(GURL(root_url), std::string(), | |
170 base::File::FILE_ERROR_SECURITY); | |
171 return; | |
172 } | |
173 root_url += authority + "/" + root_document_id + "/"; | |
mtomasz
2017/01/11 09:35:22
Does root_document_id need to be escaped?
Shuhei Takahashi
2017/01/12 08:20:28
You're right. Done.
| |
174 name = authority + ":" + root_document_id; | |
159 } else { | 175 } else { |
160 name = id; | 176 name = id; |
161 } | 177 } |
162 | 178 |
163 callback.Run(GURL(root_url), name, base::File::FILE_OK); | 179 callback.Run(GURL(root_url), name, base::File::FILE_OK); |
164 } | 180 } |
165 | 181 |
166 storage::FileSystemQuotaUtil* FileSystemBackend::GetQuotaUtil() { | 182 storage::FileSystemQuotaUtil* FileSystemBackend::GetQuotaUtil() { |
167 // No quota support. | 183 // No quota support. |
168 return NULL; | 184 return NULL; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 const base::FilePath& entry_path) const { | 478 const base::FilePath& entry_path) const { |
463 base::FilePath virtual_path; | 479 base::FilePath virtual_path; |
464 if (!GetVirtualPath(entry_path, &virtual_path)) | 480 if (!GetVirtualPath(entry_path, &virtual_path)) |
465 return storage::FileSystemURL(); | 481 return storage::FileSystemURL(); |
466 | 482 |
467 return context->CreateCrackedFileSystemURL( | 483 return context->CreateCrackedFileSystemURL( |
468 GURL() /* origin */, storage::kFileSystemTypeExternal, virtual_path); | 484 GURL() /* origin */, storage::kFileSystemTypeExternal, virtual_path); |
469 } | 485 } |
470 | 486 |
471 } // namespace chromeos | 487 } // namespace chromeos |
OLD | NEW |