Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
index 624e6ae10afdb23545a07d353bf6f43bec3e37b9..e1ee175676c0aef340a1ecc6c5c00582c6ad46bd 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
@@ -16,6 +16,7 @@ |
#include "base/platform_file.h" |
#include "base/threading/sequenced_worker_pool.h" |
#include "base/values.h" |
+#include "chrome/browser/chromeos/gdata/drive_api_parser.h" |
#include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
#include "chrome/browser/chromeos/gdata/gdata.pb.h" |
#include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
@@ -1962,7 +1963,7 @@ void GDataFileSystem::OnRequestDirectoryRefresh( |
return; |
} |
- int unused_delta_feed_changestamp = 0; |
+ int64 unused_delta_feed_changestamp = 0; |
FeedToFileResourceMapUmaStats unused_uma_stats; |
FileResourceIdMap file_map; |
GDataWapiFeedProcessor feed_processor(directory_service_.get()); |
@@ -2183,6 +2184,14 @@ void GDataFileSystem::GetAvailableSpaceOnUIThread( |
const GetAvailableSpaceCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (gdata::util::IsDriveV2ApiEnabled()) { |
+ documents_service_->GetAboutResource( |
+ base::Bind(&GDataFileSystem::OnGetQuotaStats, |
satorux1
2012/08/08 13:18:51
OnGetAboutResource
We usually match the function
kochi
2012/08/08 16:53:27
Done.
|
+ ui_weak_ptr_, |
+ callback)); |
+ return; |
+ } |
+ |
documents_service_->GetAccountMetadata( |
base::Bind(&GDataFileSystem::OnGetAvailableSpace, |
ui_weak_ptr_, |
@@ -2214,6 +2223,32 @@ void GDataFileSystem::OnGetAvailableSpace( |
feed->quota_bytes_used()); |
} |
+void GDataFileSystem::OnGetQuotaStats( |
+ const GetAvailableSpaceCallback& callback, |
+ GDataErrorCode status, |
+ scoped_ptr<base::Value> data) { |
satorux1
2012/08/08 13:18:51
data -> better name?
kochi
2012/08/08 16:53:27
Done.
named resource_json.
|
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ GDataFileError error = util::GDataToGDataFileError(status); |
+ if (error != GDATA_FILE_OK) { |
+ callback.Run(error, -1, -1); |
satorux1
2012/08/08 13:18:51
Historically, we check if the callback is null alm
kochi
2012/08/08 16:53:27
Done.
|
+ return; |
+ } |
+ |
+ scoped_ptr<AboutResource> about; |
+ if (data.get()) |
+ about = AboutResource::CreateFrom(*data); |
+ |
+ if (!about.get()) { |
+ callback.Run(GDATA_FILE_ERROR_FAILED, -1, -1); |
+ return; |
+ } |
+ |
+ callback.Run(GDATA_FILE_OK, |
+ about->quota_bytes_total(), |
+ about->quota_bytes_used()); |
+} |
+ |
void GDataFileSystem::OnCreateDirectoryCompleted( |
const CreateDirectoryParams& params, |
GDataErrorCode status, |
@@ -2395,8 +2430,8 @@ void GDataFileSystem::LoadRootFeedFromCacheForTesting() { |
GDataFileError GDataFileSystem::UpdateFromFeedForTesting( |
const std::vector<DocumentFeed*>& feed_list, |
- int start_changestamp, |
- int root_feed_changestamp) { |
+ int64 start_changestamp, |
+ int64 root_feed_changestamp) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
return feed_loader_->UpdateFromFeed(feed_list, |