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

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

Issue 23050014: Convert drive::FileWriteHelper to a single function for simplification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: chrome/browser/chromeos/drive/file_write_helper.cc
diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc
deleted file mode 100644
index b5623edb896502ad314343467945ac244c3e1187..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/drive/file_write_helper.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/drive/file_write_helper.h"
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/threading/sequenced_worker_pool.h"
-#include "chrome/browser/chromeos/drive/file_system_interface.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
-namespace drive {
-
-FileWriteHelper::FileWriteHelper(FileSystemInterface* file_system)
- : file_system_(file_system),
- weak_ptr_factory_(this) {
- // Must be created in DriveIntegrationService.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-}
-
-FileWriteHelper::~FileWriteHelper() {
- // Must be destroyed in DriveIntegrationService.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-}
-
-void FileWriteHelper::PrepareWritableFileAndRun(
- const base::FilePath& file_path,
- const OpenFileCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!callback.is_null());
-
- file_system_->OpenFile(
- file_path, OPEN_OR_CREATE_FILE,
- base::Bind(&FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile,
- weak_ptr_factory_.GetWeakPtr(), file_path, callback));
-}
-
-void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile(
- const base::FilePath& file_path,
- const OpenFileCallback& callback,
- FileError error,
- const base::FilePath& local_cache_path,
- const base::Closure& close_callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!callback.is_null());
-
- if (error != FILE_ERROR_OK) {
- content::BrowserThread::GetBlockingPool()->PostTask(
- FROM_HERE,
- base::Bind(callback, error, base::FilePath()));
- return;
- }
-
- content::BrowserThread::GetBlockingPool()->PostTaskAndReply(
- FROM_HERE,
- base::Bind(callback, FILE_ERROR_OK, local_cache_path),
- close_callback);
-}
-
-} // namespace drive
« no previous file with comments | « chrome/browser/chromeos/drive/file_write_helper.h ('k') | chrome/browser/chromeos/drive/file_write_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698