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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10271016: gdata: Remove use of FindEntryByPathAsync() from file_browser_private_api.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 8 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
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_browser_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index d81ae0d2f8d00866a36f2ae1fae3411b34403325..003f1dd95449db791814b640c032d77a523ce499 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -17,6 +17,7 @@
#include "base/values.h"
#include "chrome/browser/chromeos/extensions/file_handler_util.h"
#include "chrome/browser/chromeos/extensions/file_manager_util.h"
+#include "chrome/browser/chromeos/gdata/gdata.pb.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
#include "chrome/browser/chromeos/gdata/gdata_system_service.h"
@@ -1588,48 +1589,43 @@ void GetGDataFilePropertiesFunction::OnOperationComplete(
gdata::GDataSystemService* system_service =
gdata::GDataSystemServiceFactory::GetForProfile(profile_);
- system_service->file_system()->FindEntryByPathAsync(
+ system_service->file_system()->GetFileInfoByPathAsync(
path,
- base::Bind(&GetGDataFilePropertiesFunction::OnFileProperties,
+ base::Bind(&GetGDataFilePropertiesFunction::OnGetFileInfo,
this,
property_dict,
path));
}
-void GetGDataFilePropertiesFunction::OnFileProperties(
+void GetGDataFilePropertiesFunction::OnGetFileInfo(
base::DictionaryValue* property_dict,
const FilePath& file_path,
base::PlatformFileError error,
- const FilePath& /* directory_path */,
- gdata::GDataEntry* entry) {
+ scoped_ptr<gdata::GDataFileProto> file_proto) {
+ DCHECK(property_dict);
+
if (error != base::PLATFORM_FILE_OK) {
property_dict->SetInteger("errorCode", error);
CompleteGetFileProperties();
return;
}
- gdata::GDataFile* file = entry->AsGDataFile();
- if (!file) {
- LOG(WARNING) << "Reading properties of a non-file at "
- << file_path.value();
- CompleteGetFileProperties();
- return;
- }
-
- property_dict->SetString("thumbnailUrl", file->thumbnail_url().spec());
- if (!file->alternate_url().is_empty())
- property_dict->SetString("editUrl", file->alternate_url().spec());
+ property_dict->SetString("thumbnailUrl", file_proto->thumbnail_url());
Ben Chan 2012/05/01 05:09:43 perhaps DCHECK(file_proto.get()) here instead?
satorux1 2012/05/01 05:21:30 Done.
+ if (!file_proto->alternate_url().empty())
+ property_dict->SetString("editUrl", file_proto->alternate_url());
- if (!file->content_url().is_empty())
- property_dict->SetString("contentUrl", file->content_url().spec());
+ if (!file_proto->gdata_entry().content_url().empty()) {
+ property_dict->SetString("contentUrl",
+ file_proto->gdata_entry().content_url());
+ }
- property_dict->SetBoolean("isHosted", file->is_hosted_document());
+ property_dict->SetBoolean("isHosted", file_proto->is_hosted_document());
gdata::GDataSystemService* system_service =
gdata::GDataSystemServiceFactory::GetForProfile(profile_);
system_service->file_system()->GetCacheState(
- file->resource_id(),
- file->file_md5(),
+ file_proto->gdata_entry().resource_id(),
+ file_proto->file_md5(),
base::Bind(
&GetGDataFilePropertiesFunction::CacheStateReceived,
this, property_dict));
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698