gdata: Remove GDataCache::UpdateCacheWithSubDirectoryType()

Now UpdateCacheWithSubDirectoryType() is trivial enough (it used to be bigger)
to be gone.

BUG=136625
TEST=out/Release/unit_tests --gtest_filter=GData*

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146203 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc
index 8d26529..480a2be4 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc
@@ -881,9 +881,8 @@
   if (*error == base::PLATFORM_FILE_OK) {
     // Now that file operations have completed, update cache map.
     new_cache_entry.SetPresent(true);
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    sub_dir_type,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -971,9 +970,8 @@
   if (*error == base::PLATFORM_FILE_OK) {
     // Now that file operations have completed, update cache map.
     new_cache_entry.SetPinned(true);
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    sub_dir_type,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -1053,9 +1051,8 @@
     // Now that file operations have completed, update cache map.
     CacheEntry new_cache_entry(md5, cache_entry->cache_state);
     new_cache_entry.SetPinned(false);
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    sub_dir_type,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -1119,9 +1116,8 @@
                             FILE_OPERATION_MOVE, FilePath(), false);
   if (*error == base::PLATFORM_FILE_OK) {
     // Now that cache operation is complete, update cache map
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    dest_subdir,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(dest_subdir == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -1199,7 +1195,7 @@
       CACHED_FILE_FROM_SERVER);
 
   // Determine destination path.
-  CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT;
+  const CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT;
   *cache_file_path = GetCacheFilePath(resource_id,
                                       md5,
                                       sub_dir_type,
@@ -1225,9 +1221,8 @@
     // Now that file operations have completed, update cache map.
     CacheEntry new_cache_entry(md5, cache_entry->cache_state);
     new_cache_entry.SetDirty(true);
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    sub_dir_type,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -1334,7 +1329,7 @@
   // Determine destination path.
   // If file is pinned, move it to persistent dir with .md5 extension;
   // otherwise, move it to tmp dir with .md5 extension.
-  CacheSubDirectoryType sub_dir_type =
+  const CacheSubDirectoryType sub_dir_type =
       cache_entry->IsPinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP;
   FilePath dest_path = GetCacheFilePath(resource_id,
                                         md5,
@@ -1374,9 +1369,8 @@
     // Now that file operations have completed, update cache map.
     CacheEntry new_cache_entry(md5, cache_entry->cache_state);
     new_cache_entry.SetDirty(false);
-    UpdateCacheWithSubDirectoryType(resource_id,
-                                    sub_dir_type,
-                                    new_cache_entry);
+    new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+    metadata_->UpdateCache(resource_id, new_cache_entry);
   }
 }
 
@@ -1511,19 +1505,6 @@
     *cache_entry = *value;
 }
 
-void GDataCache::UpdateCacheWithSubDirectoryType(
-    const std::string& resource_id,
-    CacheSubDirectoryType sub_dir_type,
-    const CacheEntry& in_cache_entry) {
-  DCHECK(sub_dir_type == CACHE_TYPE_PERSISTENT ||
-         sub_dir_type == CACHE_TYPE_TMP);
-
-  CacheEntry cache_entry = in_cache_entry;
-  cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
-
-  metadata_->UpdateCache(resource_id, cache_entry);
-}
-
 // static
 FilePath GDataCache::GetCacheRootPath(Profile* profile) {
   FilePath cache_base_path;