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

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

Issue 23258006: drive: Move RefreshDirectory from ResourceMetadata to ChangeListLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix 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/change_list_loader.cc
diff --git a/chrome/browser/chromeos/drive/change_list_loader.cc b/chrome/browser/chromeos/drive/change_list_loader.cc
index 711a7149418f3c43fd94563a7df0f64a79a6010c..3e33a6aedd80e862dcafebd54481c4196526c7a0 100644
--- a/chrome/browser/chromeos/drive/change_list_loader.cc
+++ b/chrome/browser/chromeos/drive/change_list_loader.cc
@@ -556,21 +556,22 @@ void ChangeListLoader::DoLoadGrandRootDirectoryFromServerAfterGetAboutResource(
return;
}
- // Build entry map for grand root directory, since the special static
- // directory "drive/other" is always created during the initialization of
- // ResourceMetadata, here we only need to create a dynamic directory
- // "drive/root" from its resource ID.
- ResourceEntryMap grand_root_entry_map;
+ // Grand root will be changed.
+ base::FilePath* changed_directory_path =
+ new base::FilePath(util::GetDriveGrandRootPath());
+ // Add "My Drive".
const std::string& root_resource_id = about_resource->root_folder_id();
- grand_root_entry_map[root_resource_id] =
- util::CreateMyDriveRootEntry(root_resource_id);
- resource_metadata_->RefreshDirectoryOnUIThread(
- directory_fetch_info,
- grand_root_entry_map,
+ base::PostTaskAndReplyWithResult(
+ blocking_task_runner_,
+ FROM_HERE,
+ base::Bind(&ResourceMetadata::AddEntry,
+ base::Unretained(resource_metadata_),
+ util::CreateMyDriveRootEntry(root_resource_id)),
base::Bind(&ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh,
weak_ptr_factory_.GetWeakPtr(),
directory_fetch_info,
- callback));
+ callback,
+ base::Owned(changed_directory_path)));
}
void ChangeListLoader::DoLoadDirectoryFromServerAfterLoad(
@@ -592,20 +593,27 @@ void ChangeListLoader::DoLoadDirectoryFromServerAfterLoad(
ChangeListProcessor::ResourceEntryMap entry_map;
ChangeListProcessor::ConvertToMap(change_lists.Pass(), &entry_map, NULL);
- resource_metadata_->RefreshDirectoryOnUIThread(
- directory_fetch_info,
- entry_map,
+ base::FilePath* directory_path = new base::FilePath;
+ base::PostTaskAndReplyWithResult(
+ blocking_task_runner_,
+ FROM_HERE,
+ base::Bind(&ChangeListProcessor::RefreshDirectory,
+ resource_metadata_,
+ directory_fetch_info,
+ entry_map,
+ directory_path),
base::Bind(&ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh,
weak_ptr_factory_.GetWeakPtr(),
directory_fetch_info,
- callback));
+ callback,
+ base::Owned(directory_path)));
}
void ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh(
const DirectoryFetchInfo& directory_fetch_info,
const FileOperationCallback& callback,
- FileError error,
- const base::FilePath& directory_path) {
+ const base::FilePath* directory_path,
+ FileError error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
@@ -614,7 +622,7 @@ void ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh(
// Also notify the observers.
if (error == FILE_ERROR_OK) {
FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_,
- OnDirectoryChanged(directory_path));
+ OnDirectoryChanged(*directory_path));
}
}
« no previous file with comments | « chrome/browser/chromeos/drive/change_list_loader.h ('k') | chrome/browser/chromeos/drive/change_list_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698