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 "apps/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 void FileSystemRetainEntryFunction::RetainFileEntry( | 967 void FileSystemRetainEntryFunction::RetainFileEntry( |
968 const std::string& entry_id) { | 968 const std::string& entry_id) { |
969 SavedFilesService* saved_files_service = SavedFilesService::Get(profile()); | 969 SavedFilesService* saved_files_service = SavedFilesService::Get(profile()); |
970 saved_files_service->RegisterFileEntry( | 970 saved_files_service->RegisterFileEntry( |
971 extension_->id(), entry_id, path_, is_directory_); | 971 extension_->id(), entry_id, path_, is_directory_); |
972 saved_files_service->EnqueueFileEntry(extension_->id(), entry_id); | 972 saved_files_service->EnqueueFileEntry(extension_->id(), entry_id); |
973 SendResponse(true); | 973 SendResponse(true); |
974 } | 974 } |
975 | 975 |
976 void FileSystemRetainEntryFunction::SetIsDirectoryOnFileThread() { | 976 void FileSystemRetainEntryFunction::SetIsDirectoryOnFileThread() { |
977 if (base::DirectoryExists(path_)) { | 977 is_directory_ = base::DirectoryExists(path_); |
978 is_directory_ = true; | |
979 } | |
980 } | 978 } |
981 | 979 |
982 bool FileSystemIsRestorableFunction::RunImpl() { | 980 bool FileSystemIsRestorableFunction::RunImpl() { |
983 std::string entry_id; | 981 std::string entry_id; |
984 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &entry_id)); | 982 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &entry_id)); |
985 SetResult(new base::FundamentalValue(SavedFilesService::Get( | 983 SetResult(new base::FundamentalValue(SavedFilesService::Get( |
986 profile())->IsRegistered(extension_->id(), entry_id))); | 984 profile())->IsRegistered(extension_->id(), entry_id))); |
987 return true; | 985 return true; |
988 } | 986 } |
989 | 987 |
(...skipping 18 matching lines...) Expand all Loading... |
1008 if (needs_new_entry) { | 1006 if (needs_new_entry) { |
1009 is_directory_ = file_entry->is_directory; | 1007 is_directory_ = file_entry->is_directory; |
1010 CreateResponse(); | 1008 CreateResponse(); |
1011 AddEntryToResponse(file_entry->path, file_entry->id); | 1009 AddEntryToResponse(file_entry->path, file_entry->id); |
1012 } | 1010 } |
1013 SendResponse(true); | 1011 SendResponse(true); |
1014 return true; | 1012 return true; |
1015 } | 1013 } |
1016 | 1014 |
1017 } // namespace extensions | 1015 } // namespace extensions |
OLD | NEW |