summaryrefslogtreecommitdiffstats
path: root/ios/chrome/app/resources/omaha/omaha.js
blob: f950ea6bd384177640129c427eeecfec889f1df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * Requests the debug information from the backend.
 */
function requestOmahaDebugInformation() {
  chrome.send('requestOmahaDebugInformation');
}

/**
 * Update the visibility state of the given element. Using the hidden attribute
 * is not supported on iOS 4.3.
 * @param {Element} element The element to update.
 * @param {boolean} visible The new visibility state.
 */
function setVisible(element, visible) {
  element.style.display = visible ? 'inline' : 'none';
}

/**
 * Callback from backend with the debug informations. Construct the UI.
 * @param {Object} information The debug information.
 */
function updateOmahaDebugInformation(information) {
  for (key in information) {
    $(key).textContent = information[key];
    setVisible($(key + '-tr'), true);
  }
}

document.addEventListener('DOMContentLoaded', requestOmahaDebugInformation);