| 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" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return false; | 174 return false; |
| 175 | 175 |
| 176 std::string extension_id = url.origin().host(); | 176 std::string extension_id = url.origin().host(); |
| 177 // TODO(mtomasz): Temporarily whitelist TimeScapes. Remove this in M-31. | 177 // TODO(mtomasz): Temporarily whitelist TimeScapes. Remove this in M-31. |
| 178 // See: crbug.com/271946 | 178 // See: crbug.com/271946 |
| 179 if (extension_id == "mlbmkoenclnokonejhlfakkeabdlmpek" && | 179 if (extension_id == "mlbmkoenclnokonejhlfakkeabdlmpek" && |
| 180 url.type() == storage::kFileSystemTypeRestrictedNativeLocal) { | 180 url.type() == storage::kFileSystemTypeRestrictedNativeLocal) { |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Grant access for URL having "drive:" scheme. The URL filesystem:drive:/xxx | 184 // Grant access for URL having "externalfile:" scheme. The URL |
| 185 // cannot be parsed directly. The URL is created only by DriveURLRequestJob. | 185 // filesystem:externalfile:/xxx cannot be parsed directly. The URL is created |
| 186 if (url.origin().scheme() == chrome::kDriveScheme) | 186 // only by DriveURLRequestJob. |
| 187 if (url.origin().scheme() == chrome::kExternalFileScheme) |
| 187 return true; | 188 return true; |
| 188 | 189 |
| 189 // Check first to make sure this extension has fileBrowserHander permissions. | 190 // Check first to make sure this extension has fileBrowserHander permissions. |
| 190 if (!special_storage_policy_.get() || | 191 if (!special_storage_policy_.get() || |
| 191 !special_storage_policy_->IsFileHandler(extension_id)) | 192 !special_storage_policy_->IsFileHandler(extension_id)) |
| 192 return false; | 193 return false; |
| 193 | 194 |
| 194 return file_access_permissions_->HasAccessPermission(extension_id, | 195 return file_access_permissions_->HasAccessPermission(extension_id, |
| 195 url.virtual_path()); | 196 url.virtual_path()); |
| 196 } | 197 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 case storage::kFileSystemTypeRestrictedNativeLocal: | 433 case storage::kFileSystemTypeRestrictedNativeLocal: |
| 433 callback.Run(GURL()); | 434 callback.Run(GURL()); |
| 434 return; | 435 return; |
| 435 default: | 436 default: |
| 436 NOTREACHED(); | 437 NOTREACHED(); |
| 437 } | 438 } |
| 438 callback.Run(GURL()); | 439 callback.Run(GURL()); |
| 439 } | 440 } |
| 440 | 441 |
| 441 } // namespace chromeos | 442 } // namespace chromeos |
| OLD | NEW |