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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void FileSystemEntryFunction::RegisterFileSystemAndSendResponse( | 251 void FileSystemEntryFunction::RegisterFileSystemAndSendResponse( |
252 const FilePath& path, EntryType entry_type) { | 252 const FilePath& path, EntryType entry_type) { |
253 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 253 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
254 | 254 |
255 fileapi::IsolatedContext* isolated_context = | 255 fileapi::IsolatedContext* isolated_context = |
256 fileapi::IsolatedContext::GetInstance(); | 256 fileapi::IsolatedContext::GetInstance(); |
257 DCHECK(isolated_context); | 257 DCHECK(isolated_context); |
258 | 258 |
259 std::string registered_name; | 259 std::string registered_name; |
260 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( | 260 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( |
261 fileapi::kFileSystemTypeIsolated, path, ®istered_name); | 261 fileapi::kFileSystemTypeNativeLocal, path, ®istered_name); |
262 | 262 |
263 content::ChildProcessSecurityPolicy* policy = | 263 content::ChildProcessSecurityPolicy* policy = |
264 content::ChildProcessSecurityPolicy::GetInstance(); | 264 content::ChildProcessSecurityPolicy::GetInstance(); |
265 int renderer_id = render_view_host_->GetProcess()->GetID(); | 265 int renderer_id = render_view_host_->GetProcess()->GetID(); |
266 if (entry_type == WRITABLE) | 266 if (entry_type == WRITABLE) |
267 policy->GrantReadWriteFileSystem(renderer_id, filesystem_id); | 267 policy->GrantReadWriteFileSystem(renderer_id, filesystem_id); |
268 else | 268 else |
269 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 269 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
270 | 270 |
271 // We only need file level access for reading FileEntries. Saving FileEntries | 271 // We only need file level access for reading FileEntries. Saving FileEntries |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { | 554 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { |
555 error_ = kRequiresFileSystemWriteError; | 555 error_ = kRequiresFileSystemWriteError; |
556 return false; | 556 return false; |
557 } | 557 } |
558 | 558 |
559 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); | 559 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); |
560 } | 560 } |
561 | 561 |
562 } // namespace extensions | 562 } // namespace extensions |
OLD | NEW |