summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 05:03:59 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 05:03:59 +0000
commitffa23cb64a160d19b513a069ab4b29df3d69e1e1 (patch)
treefbe5c2965d6fb6e3ee842de9df696bf02177d1b3
parent570085f735b5c22f35001c922dbab5e55d7de3d4 (diff)
downloadchromium_src-ffa23cb64a160d19b513a069ab4b29df3d69e1e1.zip
chromium_src-ffa23cb64a160d19b513a069ab4b29df3d69e1e1.tar.gz
chromium_src-ffa23cb64a160d19b513a069ab4b29df3d69e1e1.tar.bz2
drive: Split update of "Account Metadata" into remote and local parts.
Otherwise, we cannot see the local metadata information until we get online and connected to the remote server. BUG=158010 TEST=Open chrome:drive-internals and verify local changestamp is shown earlier than remote timestamp. Review URL: https://chromiumcodereview.appspot.com/11275095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165620 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/chromeos/drive_internals.html16
-rw-r--r--chrome/browser/resources/chromeos/drive_internals.js15
-rw-r--r--chrome/browser/ui/webui/chromeos/drive_internals_ui.cc24
3 files changed, 37 insertions, 18 deletions
diff --git a/chrome/browser/resources/chromeos/drive_internals.html b/chrome/browser/resources/chromeos/drive_internals.html
index 7dc8e40..bdcb2ed 100644
--- a/chrome/browser/resources/chromeos/drive_internals.html
+++ b/chrome/browser/resources/chromeos/drive_internals.html
@@ -19,22 +19,18 @@
<ul id='drive-related-preferences'>
</ul>
- <h2 id='auth-status-contents-section'>Authentication Status</h2>
+ <h2 id='authentication-status-section'>Authentication Status</h2>
<ul>
<li>Has refresh token: <span id='has-refresh-token'></span></li>
<li>Has access token: <span id='has-access-token'></span></li>
</ul>
- <h2 id='account-metadata-contents-section'>Account Metadata</h2>
+ <h2 id='account-metadata-section'>Account Metadata</h2>
<ul>
<li>Quota Information: <span id='account-quota-info'></span></li>
<li>Largest Changestamp (remote):
<span id='account-largest-changestamp-remote'></span>
</li>
- <li>Largest Changestamp (local):
- <span id='account-largest-changestamp-local'></span>
- </li>
- <li>Origin: <span id='account-metadata-origin'></span></li>
</ul>
<table>
<tbody id='account-installed-apps'>
@@ -47,6 +43,14 @@
</tbody>
</table>
+ <h2 id='local-metadata-section'>Local Metadata</h2>
+ <ul>
+ <li>Largest Changestamp (local):
+ <span id='account-largest-changestamp-local'></span>
+ </li>
+ <li>Origin: <span id='account-metadata-origin'></span></li>
+ </ul>
+
<h2 id='delta-update-status-section'>Delta Update Status</h2>
<ul>
<li>Push notification is enabled:
diff --git a/chrome/browser/resources/chromeos/drive_internals.js b/chrome/browser/resources/chromeos/drive_internals.js
index 5c90d99..bc90983 100644
--- a/chrome/browser/resources/chromeos/drive_internals.js
+++ b/chrome/browser/resources/chromeos/drive_internals.js
@@ -145,10 +145,6 @@ function updateAccountMetadata(accountMetadata) {
quotaUsedInMb + ' / ' + quotaTotalInMb + ' (MB)';
$('account-largest-changestamp-remote').textContent =
accountMetadata['account-largest-changestamp-remote'];
- $('account-largest-changestamp-local').textContent =
- accountMetadata['account-largest-changestamp-local'];
- $('account-metadata-origin').textContent =
- accountMetadata['account-metadata-origin'];
var installedAppContainer = $('account-installed-apps');
for (var i = 0; i < accountMetadata['installed-apps'].length; i++) {
@@ -165,6 +161,17 @@ function updateAccountMetadata(accountMetadata) {
}
/**
+ * Updates the local cache information about account metadata.
+ * @param {Object} localMetadata Dictionary describing account metadata.
+ */
+function updateLocalMetadata(localMetadata) {
+ $('account-largest-changestamp-local').textContent =
+ localMetadata['account-largest-changestamp-local'];
+ $('account-metadata-origin').textContent =
+ localMetadata['account-metadata-origin'];
+}
+
+/**
* Updates the summary about delta update status.
* @param {Object} deltaUpdateStatus Dictionary describing delta update status.
*/
diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index 7d3715d..075684c 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -192,6 +192,8 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
google_apis::DriveServiceInterface* drive_service);
void UpdateAccountMetadataSection(
google_apis::DriveServiceInterface* drive_service);
+ void UpdateLocalMetadataSection(
+ google_apis::DriveServiceInterface* drive_service);
void UpdateDeltaUpdateStatusSection();
void UpdateInFlightOperationsSection(
google_apis::DriveServiceInterface* drive_service);
@@ -284,13 +286,6 @@ void DriveInternalsWebUIHandler::OnGetAccountMetadata(
account_metadata.Set("installed-apps", installed_apps);
}
- // Add the local largest chargestamp.
- const drive::DriveFileSystemMetadata metadata =
- GetSystemService()->file_system()->GetMetadata();
- account_metadata.SetDouble("account-largest-changestamp-local",
- metadata.largest_changestamp);
- account_metadata.SetString("account-metadata-origin", metadata.origin);
-
web_ui()->CallJavascriptFunction("updateAccountMetadata", account_metadata);
}
@@ -328,6 +323,7 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) {
UpdateDriveRelatedPreferencesSection();
UpdateAuthStatusSection(drive_service);
UpdateAccountMetadataSection(drive_service);
+ UpdateLocalMetadataSection(drive_service);
UpdateDeltaUpdateStatusSection();
UpdateInFlightOperationsSection(drive_service);
UpdateGCacheContentsSection();
@@ -405,6 +401,19 @@ void DriveInternalsWebUIHandler::UpdateAccountMetadataSection(
weak_ptr_factory_.GetWeakPtr()));
}
+void DriveInternalsWebUIHandler::UpdateLocalMetadataSection(
+ google_apis::DriveServiceInterface* drive_service) {
+ DCHECK(drive_service);
+
+ base::DictionaryValue local_metadata;
+ const drive::DriveFileSystemMetadata metadata =
+ GetSystemService()->file_system()->GetMetadata();
+ local_metadata.SetDouble("account-largest-changestamp-local",
+ metadata.largest_changestamp);
+ local_metadata.SetString("account-metadata-origin", metadata.origin);
+ web_ui()->CallJavascriptFunction("updateLocalMetadata", local_metadata);
+}
+
void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection() {
const drive::DriveFileSystemMetadata metadata =
GetSystemService()->file_system()->GetMetadata();
@@ -424,7 +433,6 @@ void DriveInternalsWebUIHandler::UpdateDeltaUpdateStatusSection() {
web_ui()->CallJavascriptFunction("updateDeltaUpdateStatus",
delta_update_status);
-
}
void DriveInternalsWebUIHandler::UpdateInFlightOperationsSection(