| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (!policy->CanReadFileSystem(render_view_host->GetProcess()->GetID(), | 149 if (!policy->CanReadFileSystem(render_view_host->GetProcess()->GetID(), |
| 150 filesystem_id)) { | 150 filesystem_id)) { |
| 151 *error = kSecurityError; | 151 *error = kSecurityError; |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 IsolatedContext* context = IsolatedContext::GetInstance(); | 155 IsolatedContext* context = IsolatedContext::GetInstance(); |
| 156 FilePath relative_path = FilePath::FromUTF8Unsafe(filesystem_path); | 156 FilePath relative_path = FilePath::FromUTF8Unsafe(filesystem_path); |
| 157 FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id) | 157 FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id) |
| 158 .Append(relative_path); | 158 .Append(relative_path); |
| 159 if (!context->CrackIsolatedPath(virtual_path, | 159 if (!context->CrackVirtualPath(virtual_path, |
| 160 &filesystem_id, | 160 &filesystem_id, |
| 161 NULL, | 161 NULL, |
| 162 file_path)) { | 162 file_path)) { |
| 163 *error = kInvalidParameters; | 163 *error = kInvalidParameters; |
| 164 return false; | 164 return false; |
| 165 } | 165 } |
| 166 | 166 |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool DoCheckWritableFile(const FilePath& path) { | 170 bool DoCheckWritableFile(const FilePath& path) { |
| 171 // Don't allow links. | 171 // Don't allow links. |
| 172 if (file_util::PathExists(path) && file_util::IsLink(path)) | 172 if (file_util::PathExists(path) && file_util::IsLink(path)) |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 591 |
| 592 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { | 592 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { |
| 593 error_ = kRequiresFileSystemWriteError; | 593 error_ = kRequiresFileSystemWriteError; |
| 594 return false; | 594 return false; |
| 595 } | 595 } |
| 596 | 596 |
| 597 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); | 597 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); |
| 598 } | 598 } |
| 599 | 599 |
| 600 } // namespace extensions | 600 } // namespace extensions |
| OLD | NEW |