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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 GrantedFileEntry file_entry = app_file_handler_util::CreateFileEntry( | 539 GrantedFileEntry file_entry = app_file_handler_util::CreateFileEntry( |
540 GetProfile(), | 540 GetProfile(), |
541 extension(), | 541 extension(), |
542 render_frame_host()->GetProcess()->GetID(), | 542 render_frame_host()->GetProcess()->GetID(), |
543 path, | 543 path, |
544 is_directory_); | 544 is_directory_); |
545 base::ListValue* entries; | 545 base::ListValue* entries; |
546 bool success = result->GetList("entries", &entries); | 546 bool success = result->GetList("entries", &entries); |
547 DCHECK(success); | 547 DCHECK(success); |
548 | 548 |
549 base::DictionaryValue* entry = new base::DictionaryValue(); | 549 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
550 entry->SetString("fileSystemId", file_entry.filesystem_id); | 550 entry->SetString("fileSystemId", file_entry.filesystem_id); |
551 entry->SetString("baseName", file_entry.registered_name); | 551 entry->SetString("baseName", file_entry.registered_name); |
552 if (id_override.empty()) | 552 if (id_override.empty()) |
553 entry->SetString("id", file_entry.id); | 553 entry->SetString("id", file_entry.id); |
554 else | 554 else |
555 entry->SetString("id", id_override); | 555 entry->SetString("id", id_override); |
556 entry->SetBoolean("isDirectory", is_directory_); | 556 entry->SetBoolean("isDirectory", is_directory_); |
557 entries->Append(entry); | 557 entries->Append(std::move(entry)); |
558 } | 558 } |
559 | 559 |
560 void FileSystemEntryFunction::HandleWritableFileError( | 560 void FileSystemEntryFunction::HandleWritableFileError( |
561 const base::FilePath& error_path) { | 561 const base::FilePath& error_path) { |
562 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 562 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
563 error_ = base::StringPrintf(kWritableFileErrorFormat, | 563 error_ = base::StringPrintf(kWritableFileErrorFormat, |
564 error_path.BaseName().AsUTF8Unsafe().c_str()); | 564 error_path.BaseName().AsUTF8Unsafe().c_str()); |
565 SendResponse(false); | 565 SendResponse(false); |
566 } | 566 } |
567 | 567 |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); | 1448 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); |
1449 std::vector<api::file_system::Volume> result_volume_list; | 1449 std::vector<api::file_system::Volume> result_volume_list; |
1450 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); | 1450 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); |
1451 | 1451 |
1452 return RespondNow(ArgumentList( | 1452 return RespondNow(ArgumentList( |
1453 api::file_system::GetVolumeList::Results::Create(result_volume_list))); | 1453 api::file_system::GetVolumeList::Results::Create(result_volume_list))); |
1454 } | 1454 } |
1455 #endif | 1455 #endif |
1456 | 1456 |
1457 } // namespace extensions | 1457 } // namespace extensions |
OLD | NEW |