| 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/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
| 6 | 6 |
| 7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
| 8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
| 9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
| 10 #include "apps/shell_window.h" | 10 #include "apps/shell_window.h" |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 | 1047 |
| 1048 context_->operation_runner()->ReadDirectory( | 1048 context_->operation_runner()->ReadDirectory( |
| 1049 url, base::Bind(&DeveloperPrivateLoadDirectoryFunction:: | 1049 url, base::Bind(&DeveloperPrivateLoadDirectoryFunction:: |
| 1050 ReadSyncFileSystemDirectoryCb, | 1050 ReadSyncFileSystemDirectoryCb, |
| 1051 this, project_path, destination_path)); | 1051 this, project_path, destination_path)); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 void DeveloperPrivateLoadDirectoryFunction::ReadSyncFileSystemDirectoryCb( | 1054 void DeveloperPrivateLoadDirectoryFunction::ReadSyncFileSystemDirectoryCb( |
| 1055 const base::FilePath& project_path, | 1055 const base::FilePath& project_path, |
| 1056 const base::FilePath& destination_path, | 1056 const base::FilePath& destination_path, |
| 1057 base::PlatformFileError status, | 1057 base::File::Error status, |
| 1058 const fileapi::FileSystemOperation::FileEntryList& file_list, | 1058 const fileapi::FileSystemOperation::FileEntryList& file_list, |
| 1059 bool has_more) { | 1059 bool has_more) { |
| 1060 | 1060 |
| 1061 if (status != base::PLATFORM_FILE_OK) { | 1061 if (status != base::File::FILE_OK) { |
| 1062 DLOG(ERROR) << "Error in copying files from sync filesystem."; | 1062 DLOG(ERROR) << "Error in copying files from sync filesystem."; |
| 1063 return; | 1063 return; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 // We add 1 to the pending copy operations for both files and directories. We | 1066 // We add 1 to the pending copy operations for both files and directories. We |
| 1067 // release the directory copy operation once all the files under the directory | 1067 // release the directory copy operation once all the files under the directory |
| 1068 // are added for copying. We do that to ensure that pendingCopyOperationsCount | 1068 // are added for copying. We do that to ensure that pendingCopyOperationsCount |
| 1069 // does not become zero before all copy operations are finished. | 1069 // does not become zero before all copy operations are finished. |
| 1070 // In case the directory happens to be executing the last copy operation it | 1070 // In case the directory happens to be executing the last copy operation it |
| 1071 // will call SendResponse to send the response to the API. The pending copy | 1071 // will call SendResponse to send the response to the API. The pending copy |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1101 if (!pending_copy_operations_count_) { | 1101 if (!pending_copy_operations_count_) { |
| 1102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 1102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 1103 base::Bind(&DeveloperPrivateLoadDirectoryFunction::SendResponse, | 1103 base::Bind(&DeveloperPrivateLoadDirectoryFunction::SendResponse, |
| 1104 this, | 1104 this, |
| 1105 success_)); | 1105 success_)); |
| 1106 } | 1106 } |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 void DeveloperPrivateLoadDirectoryFunction::SnapshotFileCallback( | 1109 void DeveloperPrivateLoadDirectoryFunction::SnapshotFileCallback( |
| 1110 const base::FilePath& target_path, | 1110 const base::FilePath& target_path, |
| 1111 base::PlatformFileError result, | 1111 base::File::Error result, |
| 1112 const base::PlatformFileInfo& file_info, | 1112 const base::File::Info& file_info, |
| 1113 const base::FilePath& src_path, | 1113 const base::FilePath& src_path, |
| 1114 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 1114 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
| 1115 if (result != base::PLATFORM_FILE_OK) { | 1115 if (result != base::File::FILE_OK) { |
| 1116 SetError("Error in copying files from sync filesystem."); | 1116 SetError("Error in copying files from sync filesystem."); |
| 1117 success_ = false; | 1117 success_ = false; |
| 1118 return; | 1118 return; |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, | 1121 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
| 1122 base::Bind(&DeveloperPrivateLoadDirectoryFunction::CopyFile, | 1122 base::Bind(&DeveloperPrivateLoadDirectoryFunction::CopyFile, |
| 1123 this, | 1123 this, |
| 1124 src_path, | 1124 src_path, |
| 1125 target_path)); | 1125 target_path)); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 return true; | 1326 return true; |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 DeveloperPrivateIsProfileManagedFunction:: | 1329 DeveloperPrivateIsProfileManagedFunction:: |
| 1330 ~DeveloperPrivateIsProfileManagedFunction() { | 1330 ~DeveloperPrivateIsProfileManagedFunction() { |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 } // namespace api | 1333 } // namespace api |
| 1334 | 1334 |
| 1335 } // namespace extensions | 1335 } // namespace extensions |
| OLD | NEW |