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

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

Issue 10823226: Get AboutResource as account metadata for Drive V2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_files.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 817929015d99ab157837c1e6aef270c048439cfa..071ef813adf552db50c5b036ec4131e8b72b6544 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"
@@ -1951,7 +1952,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());
@@ -2170,6 +2171,15 @@ void GDataFileSystem::GetAvailableSpace(
void GDataFileSystem::GetAvailableSpaceOnUIThread(
const GetAvailableSpaceCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
+
+ if (gdata::util::IsDriveV2ApiEnabled()) {
+ documents_service_->GetAboutResource(
+ base::Bind(&GDataFileSystem::OnGetAboutResource,
+ ui_weak_ptr_,
+ callback));
+ return;
+ }
documents_service_->GetAccountMetadata(
base::Bind(&GDataFileSystem::OnGetAvailableSpace,
@@ -2182,6 +2192,7 @@ void GDataFileSystem::OnGetAvailableSpace(
GDataErrorCode status,
scoped_ptr<base::Value> data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
GDataFileError error = util::GDataToGDataFileError(status);
if (error != GDATA_FILE_OK) {
@@ -2202,6 +2213,33 @@ void GDataFileSystem::OnGetAvailableSpace(
feed->quota_bytes_used());
}
+void GDataFileSystem::OnGetAboutResource(
+ const GetAvailableSpaceCallback& callback,
+ GDataErrorCode status,
+ scoped_ptr<base::Value> resource_json) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
+
+ GDataFileError error = util::GDataToGDataFileError(status);
+ if (error != GDATA_FILE_OK) {
+ callback.Run(error, -1, -1);
+ return;
+ }
+
+ scoped_ptr<AboutResource> about;
+ if (resource_json.get())
+ about = AboutResource::CreateFrom(*resource_json);
+
+ 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,
@@ -2383,8 +2421,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,
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_files.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698