| 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 if (url.origin().scheme() == chrome::kDriveScheme) |
| 185 return true; |
| 186 |
| 183 // Check first to make sure this extension has fileBrowserHander permissions. | 187 // Check first to make sure this extension has fileBrowserHander permissions. |
| 184 if (!special_storage_policy_.get() || | 188 if (!special_storage_policy_.get() || |
| 185 !special_storage_policy_->IsFileHandler(extension_id)) | 189 !special_storage_policy_->IsFileHandler(extension_id)) |
| 186 return false; | 190 return false; |
| 187 | 191 |
| 188 return file_access_permissions_->HasAccessPermission(extension_id, | 192 return file_access_permissions_->HasAccessPermission(extension_id, |
| 189 url.virtual_path()); | 193 url.virtual_path()); |
| 190 } | 194 } |
| 191 | 195 |
| 192 void FileSystemBackend::GrantFullAccessToExtension( | 196 void FileSystemBackend::GrantFullAccessToExtension( |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 case storage::kFileSystemTypeRestrictedNativeLocal: | 429 case storage::kFileSystemTypeRestrictedNativeLocal: |
| 426 callback.Run(GURL()); | 430 callback.Run(GURL()); |
| 427 return; | 431 return; |
| 428 default: | 432 default: |
| 429 NOTREACHED(); | 433 NOTREACHED(); |
| 430 } | 434 } |
| 431 callback.Run(GURL()); | 435 callback.Run(GURL()); |
| 432 } | 436 } |
| 433 | 437 |
| 434 } // namespace chromeos | 438 } // namespace chromeos |
| OLD | NEW |