Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc |
| diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc |
| index 30c3e543bbe59973c318722517d80885b9d7a261..e5bb62e33f8b1c0f226fda7c8ce08569e12bdf64 100644 |
| --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc |
| +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc |
| @@ -363,9 +363,14 @@ void LogDefaultTask(const std::set<std::string>& mime_types, |
| void DoNothingWithBool(bool /* success */) { |
| } |
| -void FillDriveFilePropertiesValue( |
| +void FillDriveEntryPropertiesValue( |
| const drive::DriveEntryProto& entry_proto, |
| DictionaryValue* property_dict) { |
| + property_dict->SetBoolean("sharedWithMe", entry_proto.shared_with_me()); |
| + |
| + if (!entry_proto.has_file_specific_info()) |
| + return; |
| + |
| const drive::DriveFileSpecificInfo& file_specific_info = |
| entry_proto.file_specific_info(); |
| @@ -565,7 +570,7 @@ FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) |
| registry->RegisterFunction<GetSizeStatsFunction>(); |
| registry->RegisterFunction<FormatDeviceFunction>(); |
| registry->RegisterFunction<ViewFilesFunction>(); |
| - registry->RegisterFunction<GetDriveFilePropertiesFunction>(); |
| + registry->RegisterFunction<GetDriveEntryPropertiesFunction>(); |
| registry->RegisterFunction<PinDriveFileFunction>(); |
| registry->RegisterFunction<GetFileLocationsFunction>(); |
| registry->RegisterFunction<GetDriveFilesFunction>(); |
| @@ -2305,13 +2310,13 @@ bool FileDialogStringsFunction::RunImpl() { |
| return true; |
| } |
| -GetDriveFilePropertiesFunction::GetDriveFilePropertiesFunction() { |
| +GetDriveEntryPropertiesFunction::GetDriveEntryPropertiesFunction() { |
| } |
| -GetDriveFilePropertiesFunction::~GetDriveFilePropertiesFunction() { |
| +GetDriveEntryPropertiesFunction::~GetDriveEntryPropertiesFunction() { |
| } |
| -bool GetDriveFilePropertiesFunction::RunImpl() { |
| +bool GetDriveEntryPropertiesFunction::RunImpl() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| std::string file_url_str; |
| @@ -2335,28 +2340,22 @@ bool GetDriveFilePropertiesFunction::RunImpl() { |
| system_service->file_system()->GetEntryInfoByPath( |
| file_path_, |
| - base::Bind(&GetDriveFilePropertiesFunction::OnGetFileInfo, this)); |
| + base::Bind(&GetDriveEntryPropertiesFunction::OnGetFileInfo, this)); |
| return true; |
| } |
| -void GetDriveFilePropertiesFunction::OnGetFileInfo( |
| +void GetDriveEntryPropertiesFunction::OnGetFileInfo( |
| drive::FileError error, |
| scoped_ptr<drive::DriveEntryProto> entry) { |
| DCHECK(properties_); |
| - if (entry.get() && !entry->has_file_specific_info()) |
| - error = drive::FILE_ERROR_NOT_FOUND; |
| - |
| if (error != drive::FILE_ERROR_OK) { |
| CompleteGetFileProperties(error); |
| return; |
| } |
| DCHECK(entry); |
| - const drive::DriveFileSpecificInfo& file_specific_info = |
| - entry->file_specific_info(); |
| - |
| - FillDriveFilePropertiesValue(*entry, properties_.get()); |
| + FillDriveEntryPropertiesValue(*entry, properties_.get()); |
| drive::DriveSystemService* system_service = |
| drive::DriveSystemServiceFactory::GetForProfile(profile_); |
| @@ -2366,6 +2365,15 @@ void GetDriveFilePropertiesFunction::OnGetFileInfo( |
| return; |
| } |
| + // The properties meaningful for directories are already filled. |
|
satorux1
2013/05/01 06:04:41
please describe where that information was filled,
Haruki Sato
2013/05/01 06:26:31
Done.
|
| + if (entry.get() && !entry->has_file_specific_info()) { |
| + CompleteGetFileProperties(error); |
| + return; |
| + } |
| + |
| + const drive::DriveFileSpecificInfo& file_specific_info = |
| + entry->file_specific_info(); |
| + |
| // Get drive WebApps that can accept this file. |
| ScopedVector<drive::DriveWebAppInfo> web_apps; |
| system_service->webapps_registry()->GetWebAppsForFile( |
| @@ -2405,10 +2413,10 @@ void GetDriveFilePropertiesFunction::OnGetFileInfo( |
| system_service->file_system()->GetCacheEntryByResourceId( |
| entry->resource_id(), |
| file_specific_info.file_md5(), |
| - base::Bind(&GetDriveFilePropertiesFunction::CacheStateReceived, this)); |
| + base::Bind(&GetDriveEntryPropertiesFunction::CacheStateReceived, this)); |
| } |
| -void GetDriveFilePropertiesFunction::CacheStateReceived( |
| +void GetDriveEntryPropertiesFunction::CacheStateReceived( |
| bool /* success */, |
| const drive::CacheEntry& cache_entry) { |
| // In case of an error (i.e. success is false), cache_entry.is_*() all |
| @@ -2420,7 +2428,7 @@ void GetDriveFilePropertiesFunction::CacheStateReceived( |
| CompleteGetFileProperties(drive::FILE_ERROR_OK); |
| } |
| -void GetDriveFilePropertiesFunction::CompleteGetFileProperties( |
| +void GetDriveEntryPropertiesFunction::CompleteGetFileProperties( |
| drive::FileError error) { |
| if (error != drive::FILE_ERROR_OK) |
| properties_->SetInteger("errorCode", error); |