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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void FileSystemEntryFunction::RegisterFileSystemAndSendResponse( | 289 void FileSystemEntryFunction::RegisterFileSystemAndSendResponse( |
290 const FilePath& path, EntryType entry_type) { | 290 const FilePath& path, EntryType entry_type) { |
291 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 291 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
292 | 292 |
293 fileapi::IsolatedContext* isolated_context = | 293 fileapi::IsolatedContext* isolated_context = |
294 fileapi::IsolatedContext::GetInstance(); | 294 fileapi::IsolatedContext::GetInstance(); |
295 DCHECK(isolated_context); | 295 DCHECK(isolated_context); |
296 | 296 |
297 std::string registered_name; | 297 std::string registered_name; |
298 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( | 298 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( |
299 fileapi::kFileSystemTypeNativeLocal, path, ®istered_name); | 299 fileapi::kFileSystemTypeIsolatedNativeLocal, path, ®istered_name); |
300 | 300 |
301 content::ChildProcessSecurityPolicy* policy = | 301 content::ChildProcessSecurityPolicy* policy = |
302 content::ChildProcessSecurityPolicy::GetInstance(); | 302 content::ChildProcessSecurityPolicy::GetInstance(); |
303 int renderer_id = render_view_host_->GetProcess()->GetID(); | 303 int renderer_id = render_view_host_->GetProcess()->GetID(); |
304 if (entry_type == WRITABLE) | 304 if (entry_type == WRITABLE) |
305 policy->GrantReadWriteFileSystem(renderer_id, filesystem_id); | 305 policy->GrantReadWriteFileSystem(renderer_id, filesystem_id); |
306 else | 306 else |
307 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 307 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
308 | 308 |
309 // We only need file level access for reading FileEntries. Saving FileEntries | 309 // We only need file level access for reading FileEntries. Saving FileEntries |
(...skipping 281 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 |