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) | |
mtomasz
2014/09/19 05:30:53
nit: We should either have a test that such url ca
hirono
2014/09/19 06:26:36
I added a comment. Let me add a test to prohibit p
| |
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 case storage::kFileSystemTypeRestrictedNativeLocal: | 430 case storage::kFileSystemTypeRestrictedNativeLocal: |
427 callback.Run(GURL()); | 431 callback.Run(GURL()); |
428 return; | 432 return; |
429 default: | 433 default: |
430 NOTREACHED(); | 434 NOTREACHED(); |
431 } | 435 } |
432 callback.Run(GURL()); | 436 callback.Run(GURL()); |
433 } | 437 } |
434 | 438 |
435 } // namespace chromeos | 439 } // namespace chromeos |
OLD | NEW |