| 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/move_operation.h" | 11 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
| 12 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" | 12 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" | 13 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" |
| 14 #include "chrome/browser/chromeos/drive/file_system/touch_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 { |
| 21 | 22 |
| 22 DriveOperations::DriveOperations() { | 23 DriveOperations::DriveOperations() { |
| 23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 metadata)); | 49 metadata)); |
| 49 create_file_operation_.reset(new CreateFileOperation(blocking_task_runner, | 50 create_file_operation_.reset(new CreateFileOperation(blocking_task_runner, |
| 50 observer, | 51 observer, |
| 51 scheduler, | 52 scheduler, |
| 52 metadata, | 53 metadata, |
| 53 cache)); | 54 cache)); |
| 54 move_operation_.reset( | 55 move_operation_.reset( |
| 55 new MoveOperation(observer, scheduler, metadata)); | 56 new MoveOperation(observer, scheduler, metadata)); |
| 56 remove_operation_.reset( | 57 remove_operation_.reset( |
| 57 new RemoveOperation(observer, scheduler, metadata, cache)); | 58 new RemoveOperation(observer, scheduler, metadata, cache)); |
| 59 touch_operation_.reset( |
| 60 new TouchOperation(blocking_task_runner, observer, scheduler, metadata)); |
| 58 update_operation_.reset( | 61 update_operation_.reset( |
| 59 new UpdateOperation(observer, scheduler, metadata, cache)); | 62 new UpdateOperation(observer, scheduler, metadata, cache)); |
| 60 search_operation_.reset( | 63 search_operation_.reset( |
| 61 new SearchOperation(blocking_task_runner, scheduler, metadata)); | 64 new SearchOperation(blocking_task_runner, scheduler, metadata)); |
| 62 } | 65 } |
| 63 | 66 |
| 64 void DriveOperations::Copy(const base::FilePath& src_file_path, | 67 void DriveOperations::Copy(const base::FilePath& src_file_path, |
| 65 const base::FilePath& dest_file_path, | 68 const base::FilePath& dest_file_path, |
| 66 const FileOperationCallback& callback) { | 69 const FileOperationCallback& callback) { |
| 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 128 |
| 126 void DriveOperations::Remove(const base::FilePath& file_path, | 129 void DriveOperations::Remove(const base::FilePath& file_path, |
| 127 bool is_recursive, | 130 bool is_recursive, |
| 128 const FileOperationCallback& callback) { | 131 const FileOperationCallback& callback) { |
| 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 130 DCHECK(!callback.is_null()); | 133 DCHECK(!callback.is_null()); |
| 131 | 134 |
| 132 remove_operation_->Remove(file_path, is_recursive, callback); | 135 remove_operation_->Remove(file_path, is_recursive, callback); |
| 133 } | 136 } |
| 134 | 137 |
| 138 void DriveOperations::TouchFile(const base::FilePath& file_path, |
| 139 const base::Time& last_access_time, |
| 140 const base::Time& last_modified_time, |
| 141 const FileOperationCallback& callback) { |
| 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 143 DCHECK(!last_access_time.is_null()); |
| 144 DCHECK(!last_modified_time.is_null()); |
| 145 DCHECK(!callback.is_null()); |
| 146 |
| 147 touch_operation_->TouchFile( |
| 148 file_path, last_access_time, last_modified_time, callback); |
| 149 } |
| 150 |
| 135 void DriveOperations::UpdateFileByResourceId( | 151 void DriveOperations::UpdateFileByResourceId( |
| 136 const std::string& resource_id, | 152 const std::string& resource_id, |
| 137 DriveClientContext context, | 153 DriveClientContext context, |
| 138 const FileOperationCallback& callback) { | 154 const FileOperationCallback& callback) { |
| 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 140 DCHECK(!callback.is_null()); | 156 DCHECK(!callback.is_null()); |
| 141 | 157 |
| 142 update_operation_->UpdateFileByResourceId(resource_id, context, callback); | 158 update_operation_->UpdateFileByResourceId(resource_id, context, callback); |
| 143 } | 159 } |
| 144 | 160 |
| 145 void DriveOperations::Search(const std::string& search_query, | 161 void DriveOperations::Search(const std::string& search_query, |
| 146 const GURL& next_feed, | 162 const GURL& next_feed, |
| 147 const SearchOperationCallback& callback) { | 163 const SearchOperationCallback& callback) { |
| 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 149 DCHECK(!callback.is_null()); | 165 DCHECK(!callback.is_null()); |
| 150 | 166 |
| 151 search_operation_->Search(search_query, next_feed, callback); | 167 search_operation_->Search(search_query, next_feed, callback); |
| 152 } | 168 } |
| 153 | 169 |
| 154 } // namespace file_system | 170 } // namespace file_system |
| 155 } // namespace drive | 171 } // namespace drive |
| OLD | NEW |