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