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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" | 10 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" |
11 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" | 11 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" |
12 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 12 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 13 #include "chrome/common/url_constants.h" |
13 #include "chromeos/dbus/cros_disks_client.h" | 14 #include "chromeos/dbus/cros_disks_client.h" |
14 #include "storage/browser/blob/file_stream_reader.h" | 15 #include "storage/browser/blob/file_stream_reader.h" |
15 #include "storage/browser/fileapi/async_file_util.h" | 16 #include "storage/browser/fileapi/async_file_util.h" |
16 #include "storage/browser/fileapi/external_mount_points.h" | 17 #include "storage/browser/fileapi/external_mount_points.h" |
17 #include "storage/browser/fileapi/file_stream_writer.h" | 18 #include "storage/browser/fileapi/file_stream_writer.h" |
18 #include "storage/browser/fileapi/file_system_context.h" | 19 #include "storage/browser/fileapi/file_system_context.h" |
19 #include "storage/browser/fileapi/file_system_operation.h" | 20 #include "storage/browser/fileapi/file_system_operation.h" |
20 #include "storage/browser/fileapi/file_system_operation_context.h" | 21 #include "storage/browser/fileapi/file_system_operation_context.h" |
21 #include "storage/browser/fileapi/file_system_url.h" | 22 #include "storage/browser/fileapi/file_system_url.h" |
22 | 23 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return false; | 174 return false; |
174 | 175 |
175 std::string extension_id = url.origin().host(); | 176 std::string extension_id = url.origin().host(); |
176 // TODO(mtomasz): Temporarily whitelist TimeScapes. Remove this in M-31. | 177 // TODO(mtomasz): Temporarily whitelist TimeScapes. Remove this in M-31. |
177 // See: crbug.com/271946 | 178 // See: crbug.com/271946 |
178 if (extension_id == "mlbmkoenclnokonejhlfakkeabdlmpek" && | 179 if (extension_id == "mlbmkoenclnokonejhlfakkeabdlmpek" && |
179 url.type() == storage::kFileSystemTypeRestrictedNativeLocal) { | 180 url.type() == storage::kFileSystemTypeRestrictedNativeLocal) { |
180 return true; | 181 return true; |
181 } | 182 } |
182 | 183 |
| 184 // Grant access for URL having "drive:" scheme. The URL filesystem:drive:/xxx |
| 185 // cannot be parsed directly. The URL is created only by DriveURLRequestJob. |
| 186 if (url.origin().scheme() == chrome::kDriveScheme) |
| 187 return true; |
| 188 |
183 // Check first to make sure this extension has fileBrowserHander permissions. | 189 // Check first to make sure this extension has fileBrowserHander permissions. |
184 if (!special_storage_policy_.get() || | 190 if (!special_storage_policy_.get() || |
185 !special_storage_policy_->IsFileHandler(extension_id)) | 191 !special_storage_policy_->IsFileHandler(extension_id)) |
186 return false; | 192 return false; |
187 | 193 |
188 return file_access_permissions_->HasAccessPermission(extension_id, | 194 return file_access_permissions_->HasAccessPermission(extension_id, |
189 url.virtual_path()); | 195 url.virtual_path()); |
190 } | 196 } |
191 | 197 |
192 void FileSystemBackend::GrantFullAccessToExtension( | 198 void FileSystemBackend::GrantFullAccessToExtension( |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 case storage::kFileSystemTypeRestrictedNativeLocal: | 432 case storage::kFileSystemTypeRestrictedNativeLocal: |
427 callback.Run(GURL()); | 433 callback.Run(GURL()); |
428 return; | 434 return; |
429 default: | 435 default: |
430 NOTREACHED(); | 436 NOTREACHED(); |
431 } | 437 } |
432 callback.Run(GURL()); | 438 callback.Run(GURL()); |
433 } | 439 } |
434 | 440 |
435 } // namespace chromeos | 441 } // namespace chromeos |
OLD | NEW |