Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: chrome/browser/chromeos/drive/file_system.cc

Issue 15737031: Remove drive::file_system::Operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.h ('k') | chrome/browser/chromeos/drive/file_system/operations.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system.cc
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index 1454eddc7c013ce75389712ba231bf2fbe964482..9cba053055015e0ace617040e2011b922a6c135b 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -17,6 +17,15 @@
#include "chrome/browser/chromeos/drive/change_list_processor.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/file_cache.h"
+#include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/move_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/search_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
+#include "chrome/browser/chromeos/drive/file_system/update_operation.h"
#include "chrome/browser/chromeos/drive/file_system_observer.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/job_scheduler.h"
@@ -104,15 +113,7 @@ void FileSystem::Initialize() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
SetupChangeListLoader();
-
- // Allocate the file system operation handlers.
- operations_.Init(this, // OperationObserver
- scheduler_,
- resource_metadata_,
- cache_,
- this, // FileSystemInterface
- drive_service_,
- blocking_task_runner_);
+ SetupOperations();
PrefService* pref_service = profile_->GetPrefs();
hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableDriveHostedFiles);
@@ -141,6 +142,34 @@ void FileSystem::SetupChangeListLoader() {
change_list_loader_->AddObserver(this);
}
+void FileSystem::SetupOperations() {
+ file_system::OperationObserver* observer = this;
+ copy_operation_.reset(
+ new file_system::CopyOperation(blocking_task_runner_,
+ observer,
+ scheduler_,
+ resource_metadata_,
+ cache_,
+ this,
+ drive_service_));
+ create_directory_operation_.reset(new file_system::CreateDirectoryOperation(
+ blocking_task_runner_, observer, scheduler_, resource_metadata_));
+ create_file_operation_.reset(new file_system::CreateFileOperation(
+ blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_));
+ move_operation_.reset(new file_system::MoveOperation(
+ observer, scheduler_, resource_metadata_));
+ remove_operation_.reset(new file_system::RemoveOperation(
+ observer, scheduler_, resource_metadata_, cache_));
+ touch_operation_.reset(new file_system::TouchOperation(
+ blocking_task_runner_, observer, scheduler_, resource_metadata_));
+ download_operation_.reset(new file_system::DownloadOperation(
+ blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_));
+ update_operation_.reset(new file_system::UpdateOperation(
+ blocking_task_runner_, observer, scheduler_, resource_metadata_, cache_));
+ search_operation_.reset(new file_system::SearchOperation(
+ blocking_task_runner_, scheduler_, resource_metadata_));
+}
+
void FileSystem::CheckForUpdates() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DVLOG(1) << "CheckForUpdates";
@@ -216,20 +245,22 @@ void FileSystem::TransferFileFromRemoteToLocal(
const base::FilePath& remote_src_file_path,
const base::FilePath& local_dest_file_path,
const FileOperationCallback& callback) {
-
- operations_.TransferFileFromRemoteToLocal(remote_src_file_path,
- local_dest_file_path,
- callback);
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
+ copy_operation_->TransferFileFromRemoteToLocal(remote_src_file_path,
+ local_dest_file_path,
+ callback);
}
void FileSystem::TransferFileFromLocalToRemote(
const base::FilePath& local_src_file_path,
const base::FilePath& remote_dest_file_path,
const FileOperationCallback& callback) {
-
- operations_.TransferFileFromLocalToRemote(local_src_file_path,
- remote_dest_file_path,
- callback);
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
+ copy_operation_->TransferFileFromLocalToRemote(local_src_file_path,
+ remote_dest_file_path,
+ callback);
}
void FileSystem::Copy(const base::FilePath& src_file_path,
@@ -237,7 +268,7 @@ void FileSystem::Copy(const base::FilePath& src_file_path,
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- operations_.Copy(src_file_path, dest_file_path, callback);
+ copy_operation_->Copy(src_file_path, dest_file_path, callback);
}
void FileSystem::Move(const base::FilePath& src_file_path,
@@ -245,7 +276,7 @@ void FileSystem::Move(const base::FilePath& src_file_path,
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- operations_.Move(src_file_path, dest_file_path, callback);
+ move_operation_->Move(src_file_path, dest_file_path, callback);
}
void FileSystem::Remove(const base::FilePath& file_path,
@@ -253,7 +284,7 @@ void FileSystem::Remove(const base::FilePath& file_path,
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- operations_.Remove(file_path, is_recursive, callback);
+ remove_operation_->Remove(file_path, is_recursive, callback);
}
void FileSystem::CreateDirectory(
@@ -285,7 +316,7 @@ void FileSystem::CreateDirectoryAfterLoad(
return;
}
- operations_.CreateDirectory(
+ create_directory_operation_->CreateDirectory(
directory_path, is_exclusive, is_recursive, callback);
}
@@ -294,8 +325,7 @@ void FileSystem::CreateFile(const base::FilePath& file_path,
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
-
- operations_.CreateFile(file_path, is_exclusive, callback);
+ create_file_operation_->CreateFile(file_path, is_exclusive, callback);
}
void FileSystem::TouchFile(const base::FilePath& file_path,
@@ -306,8 +336,7 @@ void FileSystem::TouchFile(const base::FilePath& file_path,
DCHECK(!last_access_time.is_null());
DCHECK(!last_modified_time.is_null());
DCHECK(!callback.is_null());
-
- operations_.TouchFile(
+ touch_operation_->TouchFile(
file_path, last_access_time, last_modified_time, callback);
}
@@ -381,7 +410,7 @@ void FileSystem::GetFileByPath(const base::FilePath& file_path,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- operations_.EnsureFileDownloadedByPath(
+ download_operation_->EnsureFileDownloadedByPath(
file_path,
ClientContext(USER_INITIATED),
GetFileContentInitializedCallback(),
@@ -398,7 +427,7 @@ void FileSystem::GetFileByResourceId(
DCHECK(!resource_id.empty());
DCHECK(!get_file_callback.is_null());
- operations_.EnsureFileDownloadedByResourceId(
+ download_operation_->EnsureFileDownloadedByResourceId(
resource_id,
context,
GetFileContentInitializedCallback(),
@@ -416,7 +445,7 @@ void FileSystem::GetFileContentByPath(
DCHECK(!get_content_callback.is_null());
DCHECK(!completion_callback.is_null());
- operations_.EnsureFileDownloadedByPath(
+ download_operation_->EnsureFileDownloadedByPath(
file_path,
ClientContext(USER_INITIATED),
initialized_callback,
@@ -649,8 +678,7 @@ void FileSystem::UpdateFileByResourceId(
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
-
- operations_.UpdateFileByResourceId(resource_id, context, callback);
+ update_operation_->UpdateFileByResourceId(resource_id, context, callback);
}
void FileSystem::GetAvailableSpace(
@@ -688,8 +716,7 @@ void FileSystem::Search(const std::string& search_query,
const SearchCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
-
- operations_.Search(search_query, next_feed, callback);
+ search_operation_->Search(search_query, next_feed, callback);
}
void FileSystem::SearchMetadata(const std::string& query,
@@ -863,7 +890,7 @@ void FileSystem::OpenFile(const base::FilePath& file_path,
}
open_files_.insert(file_path);
- operations_.EnsureFileDownloadedByPath(
+ download_operation_->EnsureFileDownloadedByPath(
file_path,
ClientContext(USER_INITIATED),
GetFileContentInitializedCallback(),
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.h ('k') | chrome/browser/chromeos/drive/file_system/operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698