| 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/chromeos/drive/file_system/drive_operations.h" | 5 #include "chrome/browser/chromeos/drive/file_system/drive_operations.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" | 8 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" |
| 9 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h
" | 9 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h
" |
| 10 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" | 10 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" | 12 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
| 12 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" | 13 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" | 14 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" |
| 14 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" | 15 #include "chrome/browser/chromeos/drive/file_system/update_operation.h" |
| 15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 16 | 17 |
| 17 using content::BrowserThread; | 18 using content::BrowserThread; |
| 18 | 19 |
| 19 namespace drive { | 20 namespace drive { |
| 20 namespace file_system { | 21 namespace file_system { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 50 metadata)); | 51 metadata)); |
| 51 create_file_operation_.reset(new CreateFileOperation(blocking_task_runner, | 52 create_file_operation_.reset(new CreateFileOperation(blocking_task_runner, |
| 52 observer, | 53 observer, |
| 53 scheduler, | 54 scheduler, |
| 54 metadata, | 55 metadata, |
| 55 cache)); | 56 cache)); |
| 56 move_operation_.reset( | 57 move_operation_.reset( |
| 57 new MoveOperation(observer, scheduler, metadata)); | 58 new MoveOperation(observer, scheduler, metadata)); |
| 58 remove_operation_.reset( | 59 remove_operation_.reset( |
| 59 new RemoveOperation(observer, scheduler, metadata, cache)); | 60 new RemoveOperation(observer, scheduler, metadata, cache)); |
| 61 download_operation_.reset(new DownloadOperation( |
| 62 blocking_task_runner, observer, scheduler, metadata, cache)); |
| 60 update_operation_.reset( | 63 update_operation_.reset( |
| 61 new UpdateOperation(observer, scheduler, metadata, cache)); | 64 new UpdateOperation(observer, scheduler, metadata, cache)); |
| 62 search_operation_.reset( | 65 search_operation_.reset( |
| 63 new SearchOperation(blocking_task_runner, scheduler, metadata)); | 66 new SearchOperation(blocking_task_runner, scheduler, metadata)); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void DriveOperations::Copy(const base::FilePath& src_file_path, | 69 void DriveOperations::Copy(const base::FilePath& src_file_path, |
| 67 const base::FilePath& dest_file_path, | 70 const base::FilePath& dest_file_path, |
| 68 const FileOperationCallback& callback) { | 71 const FileOperationCallback& callback) { |
| 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 130 |
| 128 void DriveOperations::Remove(const base::FilePath& file_path, | 131 void DriveOperations::Remove(const base::FilePath& file_path, |
| 129 bool is_recursive, | 132 bool is_recursive, |
| 130 const FileOperationCallback& callback) { | 133 const FileOperationCallback& callback) { |
| 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 132 DCHECK(!callback.is_null()); | 135 DCHECK(!callback.is_null()); |
| 133 | 136 |
| 134 remove_operation_->Remove(file_path, is_recursive, callback); | 137 remove_operation_->Remove(file_path, is_recursive, callback); |
| 135 } | 138 } |
| 136 | 139 |
| 140 void DriveOperations::EnsureFileDownloaded( |
| 141 const base::FilePath& file_path, |
| 142 DriveClientContext context, |
| 143 const GetFileContentInitializedCallback& initialized_callback, |
| 144 const google_apis::GetContentCallback& get_content_callback, |
| 145 const GetFileCallback& completion_callback) { |
| 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 147 DCHECK(!completion_callback.is_null()); |
| 148 |
| 149 download_operation_->EnsureFileDownloaded( |
| 150 file_path, context, initialized_callback, get_content_callback, |
| 151 completion_callback); |
| 152 } |
| 153 |
| 137 void DriveOperations::UpdateFileByResourceId( | 154 void DriveOperations::UpdateFileByResourceId( |
| 138 const std::string& resource_id, | 155 const std::string& resource_id, |
| 139 DriveClientContext context, | 156 DriveClientContext context, |
| 140 const FileOperationCallback& callback) { | 157 const FileOperationCallback& callback) { |
| 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 142 DCHECK(!callback.is_null()); | 159 DCHECK(!callback.is_null()); |
| 143 | 160 |
| 144 update_operation_->UpdateFileByResourceId(resource_id, context, callback); | 161 update_operation_->UpdateFileByResourceId(resource_id, context, callback); |
| 145 } | 162 } |
| 146 | 163 |
| 147 void DriveOperations::Search(const std::string& search_query, | 164 void DriveOperations::Search(const std::string& search_query, |
| 148 const GURL& next_feed, | 165 const GURL& next_feed, |
| 149 const SearchOperationCallback& callback) { | 166 const SearchOperationCallback& callback) { |
| 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 151 DCHECK(!callback.is_null()); | 168 DCHECK(!callback.is_null()); |
| 152 | 169 |
| 153 search_operation_->Search(search_query, next_feed, callback); | 170 search_operation_->Search(search_query, next_feed, callback); |
| 154 } | 171 } |
| 155 | 172 |
| 156 } // namespace file_system | 173 } // namespace file_system |
| 157 } // namespace drive | 174 } // namespace drive |
| OLD | NEW |