Refactor CreateFileOperation by touching metadata and cache directly on blocking pool.

This CL extracts some consecutive accesses to metadata and cache, and moves it
onto blocking pool, so that it reduces the number of methods.

BUG=242025
TEST=Ran unit_tests

Review URL: https://chromiumcodereview.appspot.com/15253003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201289 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h
index fce93f1..f6d2816e 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/chrome/browser/chromeos/drive/file_cache.h
@@ -158,8 +158,8 @@
                          const std::string& md5,
                          const GetFileFromCacheCallback& callback);
 
-  // Stores |source_path| as a cache of the remote content of the file
-  // identified by |resource_id| and |md5|.
+  // Runs Store() on |blocking_task_runner_|, and calls |callback| with
+  // the result asynchronously.
   // |callback| must not be null.
   // Must be called on the UI thread.
   void StoreOnUIThread(const std::string& resource_id,
@@ -168,6 +168,13 @@
                        FileOperationType file_operation_type,
                        const FileOperationCallback& callback);
 
+  // Stores |source_path| as a cache of the remote content of the file
+  // with |resource_id| and |md5|.
+  FileError Store(const std::string& resource_Id,
+                  const std::string& md5,
+                  const base::FilePath& source_path,
+                  FileOperationType file_operation_type);
+
   // Stores |source_path| to the cache and mark it as dirty, i.e., needs to be
   // uploaded to the remove server for syncing.
   // |callback| must not be null.
@@ -335,12 +342,14 @@
   scoped_ptr<GetFileResult> GetFile(const std::string& resource_id,
                                     const std::string& md5);
 
-  // Used to implement StoreOnUIThread.
-  FileError Store(const std::string& resource_id,
-                  const std::string& md5,
-                  const base::FilePath& source_path,
-                  FileOperationType file_operation_type,
-                  CachedFileOrigin origin);
+  // Used to implement Store and StoreLocallyModifiedOnUIThread.
+  // TODO(hidehiko): Merge this method with Store(), after
+  // StoreLocallyModifiedOnUIThread is removed.
+  FileError StoreInternal(const std::string& resource_id,
+                          const std::string& md5,
+                          const base::FilePath& source_path,
+                          FileOperationType file_operation_type,
+                          CachedFileOrigin origin);
 
   // Used to implement PinOnUIThread.
   FileError Pin(const std::string& resource_id,