Commit 72b753c3 authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Move drive-internals push notifications enabled into connection status.

Bug: 896123
Change-Id: I3b1e7e8d9c189f21ec767958a1d8afb609448c00
Reviewed-on: https://chromium-review.googlesource.com/c/1350385Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610768}
parent 3fc51219
......@@ -18,6 +18,9 @@
<li>
Status: <span id="connection-status"></span>
</li>
<li>Push notifications enabled:
<span id="push-notification-enabled"></span>
</li>
<li>
Has refresh token: <span id="has-refresh-token"></span>
<button id="button-clear-refresh-token">clear</button>
......@@ -57,10 +60,6 @@
<section id="delta-update-status-section" hidden>
<h2>Delta Update Status</h2>
<ul>
<li>Push notification is enabled:
<span id="push-notification-enabled"></span></li>
</ul>
<table>
<tbody id="delta-update-status">
<tr>
......
......@@ -32,6 +32,8 @@ function updateDriveRelatedPreferences(preferences) {
*/
function updateConnectionStatus(connStatus) {
$('connection-status').textContent = connStatus['status'];
$('push-notification-enabled').textContent =
connStatus['push-notification-enabled'];
$('has-refresh-token').textContent = connStatus['has-refresh-token'];
$('has-access-token').textContent = connStatus['has-access-token'];
}
......@@ -169,9 +171,6 @@ function updateAboutResource(aboutResource) {
* @param {Object} deltaUpdateStatus Dictionary describing delta update status.
*/
function updateDeltaUpdateStatus(deltaUpdateStatus) {
$('push-notification-enabled').textContent =
deltaUpdateStatus['push-notification-enabled'];
var itemContainer = $('delta-update-status');
for (var i = 0; i < deltaUpdateStatus['items'].length; i++) {
var update = deltaUpdateStatus['items'][i];
......
......@@ -404,6 +404,14 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
base::DictionaryValue connection_status;
connection_status.SetString("status", status);
drive::DriveNotificationManager* drive_notification_manager =
drive::DriveNotificationManagerFactory::FindForBrowserContext(
profile());
connection_status.SetBoolean(
"push-notification-enabled",
drive_notification_manager
? drive_notification_manager->push_notification_enabled()
: false);
auto* drive_service = GetDriveService();
if (drive_service) {
connection_status.SetBoolean("has-refresh-token",
......@@ -477,17 +485,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
team_drive_metadata) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
drive::DriveNotificationManager* drive_notification_manager =
drive::DriveNotificationManagerFactory::FindForBrowserContext(
profile());
if (!drive_notification_manager)
return;
base::DictionaryValue delta_update_status;
delta_update_status.SetBoolean(
"push-notification-enabled",
drive_notification_manager->push_notification_enabled());
auto items = std::make_unique<base::ListValue>();
// Users default corpus first.
auto app_data = std::make_unique<base::DictionaryValue>();
......@@ -521,6 +518,7 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
items->Append(std::move(app_data));
}
base::DictionaryValue delta_update_status;
delta_update_status.Set("items", std::move(items));
MaybeCallJavascript("updateDeltaUpdateStatus",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment