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

Unified Diff: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc

Issue 11876002: Make largest_changestamp setter/getter asynchronous. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase + comment Created 7 years, 11 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/drive/mock_drive_file_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
===================================================================
--- chrome/browser/ui/webui/chromeos/drive_internals_ui.cc (revision 177026)
+++ chrome/browser/ui/webui/chromeos/drive_internals_ui.cc (working copy)
@@ -235,6 +235,14 @@
google_apis::GDataErrorCode status,
scoped_ptr<google_apis::AccountMetadataFeed> account_metadata);
+ // Callback for DriveFilesystem::GetMetadata for local update.
+ void OnGetFilesystemMetadataForLocal(
+ const drive::DriveFileSystemMetadata& metadata);
+
+ // Callback for DriveFilesystem::GetMetadata for local update.
+ void OnGetFilesystemMetadataForDeltaUpdate(
+ const drive::DriveFileSystemMetadata& metadata);
+
// Called when the page requests periodic update.
void OnPeriodicUpdate(const base::ListValue* args);
@@ -401,11 +409,18 @@
void DriveInternalsWebUIHandler::UpdateLocalMetadataSection(
google_apis::DriveServiceInterface* drive_service) {
- DCHECK(drive_service);
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ GetSystemService()->file_system()->GetMetadata(
+ base::Bind(&DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal(
+ const drive::DriveFileSystemMetadata& metadata) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
base::DictionaryValue local_metadata;
- const drive::DriveFileSystemMetadata metadata =
- GetSystemService()->file_system()->GetMetadata();
local_metadata.SetDouble("account-largest-changestamp-local",
metadata.largest_changestamp);
local_metadata.SetBoolean("account-metadata-loaded", metadata.loaded);
@@ -414,9 +429,18 @@
}
void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection() {
- const drive::DriveFileSystemMetadata metadata =
- GetSystemService()->file_system()->GetMetadata();
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ GetSystemService()->file_system()->GetMetadata(
+ base::Bind(
+ &DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate(
+ const drive::DriveFileSystemMetadata& metadata) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
base::DictionaryValue delta_update_status;
delta_update_status.SetBoolean("push-notification-enabled",
metadata.push_notification_enabled);
« no previous file with comments | « chrome/browser/chromeos/drive/mock_drive_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698