function getLoggingPref(callback) {
    // Try to look up the preference in the storage, in the following order:
    var areas = ["sync", "local", "managed"];

    next();
    function next(result) {
      var storageAreaName = areas.shift();
      if (typeof result === "boolean" || !storageAreaName) {
        callback(result);
        return;
      }

      if (!chrome.storage[storageAreaName]) {
        next();
        return;
      }

      chrome.storage[storageAreaName].get("disableTelemetry", function (items) {
        next(items && items.disableTelemetry);
      });
    }
  }
Get the value of the telemetry preference. The callback is invoked with a
boolean if a preference is found, and with the undefined value otherwise.