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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10332267: Revert 138055 - gdata: Add requestDirectoryRefresh to file_browser_private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_file_system.cc
===================================================================
--- chrome/browser/chromeos/gdata/gdata_file_system.cc (revision 138055)
+++ chrome/browser/chromeos/gdata/gdata_file_system.cc (working copy)
@@ -2551,110 +2551,6 @@
callback.Run(base::PLATFORM_FILE_OK, directory_proto.Pass());
}
-void GDataFileSystem::RequestDirectoryRefresh(
- const FilePath& file_path) {
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- const bool posted = BrowserThread::PostTask(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&GDataFileSystem::RequestDirectoryRefreshOnUIThread,
- ui_weak_ptr_,
- file_path));
- DCHECK(posted);
- return;
- }
-
- RequestDirectoryRefreshOnUIThread(file_path);
-}
-
-void GDataFileSystem::RequestDirectoryRefreshOnUIThread(
- const FilePath& file_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- GDataEntry* entry = GetGDataEntryByPath(file_path);
- if (!entry || !entry->AsGDataDirectory()) {
- LOG(ERROR) << "Directory entry not found: " << file_path.value();
- return;
- }
-
- if (entry->resource_id().empty()) {
- // This can happen if the directory is a virtual directory for search.
- LOG(ERROR) << "Resource ID not found: " << file_path.value();
- return;
- }
-
- base::AutoLock lock(lock_); // To access root_.
- LoadFeedFromServer(root_->origin(),
- 0, // Not delta feed.
- 0, // Not used.
- true, // multiple feeds
- file_path,
- std::string(), // No search query
- entry->resource_id(),
- FindEntryCallback(), // Not used.
- base::Bind(&GDataFileSystem::OnRequestDirectoryRefresh,
- ui_weak_ptr_));
-}
-
-void GDataFileSystem::OnRequestDirectoryRefresh(
- GetDocumentsParams* params,
- base::PlatformFileError error) {
- DCHECK(params);
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- const FilePath& directory_path = params->search_file_path;
- if (error != base::PLATFORM_FILE_OK) {
- LOG(ERROR) << "Failed to refresh directory: " << directory_path.value()
- << ": " << error;
- return;
- }
-
- int unused_delta_feed_changestamp = 0;
- int unused_num_regular_files = 0;
- int unused_num_hosted_documents = 0;
- FileResourceIdMap file_map;
- error = FeedToFileResourceMap(*params->feed_list,
- &file_map,
- &unused_delta_feed_changestamp,
- &unused_num_regular_files,
- &unused_num_hosted_documents);
- if (error != base::PLATFORM_FILE_OK) {
- LOG(ERROR) << "Failed to convert feed: " << directory_path.value()
- << ": " << error;
- return;
- }
-
- base::AutoLock lock(lock_); // To access root_.
-
- GDataEntry* directory_entry = root_->GetEntryByResourceId(
- params->directory_resource_id);
- if (!directory_entry || !directory_entry->AsGDataDirectory()) {
- LOG(ERROR) << "Directory entry is gone: " << directory_path.value()
- << ": " << params->directory_resource_id;
- return;
- }
- GDataDirectory* directory = directory_entry->AsGDataDirectory();
-
- // Remove the existing files.
- directory->RemoveChildFiles();
- // Go through all entires generated by the feed and add files.
- for (FileResourceIdMap::const_iterator it = file_map.begin();
- it != file_map.end(); ++it) {
- scoped_ptr<GDataEntry> entry(it->second);
- // Skip if it's not a file (i.e. directory).
- if (!entry->AsGDataFile())
- continue;
- directory->AddEntry(entry.release());
- }
-
- // Note that there may be no change in the directory, but it's expensive to
- // check if the new metadata matches the existing one, so we just always
- // notify that the directory is changed.
- NotifyDirectoryChanged(directory_path);
- DVLOG(1) << "Directory refreshed: " << directory_path.value();
-}
-
bool GDataFileSystem::GetFileInfoByPath(
const FilePath& file_path, GDataFileProperties* properties) {
DCHECK(properties);
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698