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

Side by Side Diff: chrome/browser/chromeos/drive/resource_metadata.cc

Issue 296463002: drive: Stop using FileCacheEntry related methods in FileCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Do not overwrite cache state with RefreshEntry Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/resource_metadata.h" 5 #include "chrome/browser/chromeos/drive/resource_metadata.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 // Make sure that the new parent exists and it is a directory. 381 // Make sure that the new parent exists and it is a directory.
382 ResourceEntry new_parent; 382 ResourceEntry new_parent;
383 error = storage_->GetEntry(entry.parent_local_id(), &new_parent); 383 error = storage_->GetEntry(entry.parent_local_id(), &new_parent);
384 if (error != FILE_ERROR_OK) 384 if (error != FILE_ERROR_OK)
385 return error; 385 return error;
386 386
387 if (!new_parent.file_info().is_directory()) 387 if (!new_parent.file_info().is_directory())
388 return FILE_ERROR_NOT_A_DIRECTORY; 388 return FILE_ERROR_NOT_A_DIRECTORY;
389 389
390 // Do not overwrite cache states.
391 // Cache state should be changed via FileCache.
392 ResourceEntry updated_entry(entry);
393 if (old_entry.file_specific_info().has_cache_state()) {
394 *updated_entry.mutable_file_specific_info()->mutable_cache_state() =
395 old_entry.file_specific_info().cache_state();
396 } else if (updated_entry.file_specific_info().has_cache_state()) {
397 updated_entry.mutable_file_specific_info()->clear_cache_state();
398 }
390 // Remove from the old parent and add it to the new parent with the new data. 399 // Remove from the old parent and add it to the new parent with the new data.
391 return PutEntryUnderDirectory(entry); 400 return PutEntryUnderDirectory(updated_entry);
392 } 401 }
393 402
394 FileError ResourceMetadata::GetSubDirectoriesRecursively( 403 FileError ResourceMetadata::GetSubDirectoriesRecursively(
395 const std::string& id, 404 const std::string& id,
396 std::set<base::FilePath>* sub_directories) { 405 std::set<base::FilePath>* sub_directories) {
397 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); 406 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
398 407
399 std::vector<std::string> children; 408 std::vector<std::string> children;
400 FileError error = storage_->GetChildren(id, &children); 409 FileError error = storage_->GetChildren(id, &children);
401 if (error != FILE_ERROR_OK) 410 if (error != FILE_ERROR_OK)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 593
585 error = cache_->Remove(id); 594 error = cache_->Remove(id);
586 if (error != FILE_ERROR_OK) 595 if (error != FILE_ERROR_OK)
587 return error; 596 return error;
588 597
589 return storage_->RemoveEntry(id); 598 return storage_->RemoveEntry(id);
590 } 599 }
591 600
592 } // namespace internal 601 } // namespace internal
593 } // namespace drive 602 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache_unittest.cc ('k') | chrome/browser/chromeos/drive/resource_metadata_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698