services/cloudsync/CloudSync.jsm
author Marina Samuel <msamuel@mozilla.com>
Fri, 05 Jun 2015 02:48:38 -0700
changeset 278200 8ed8f05c29c08eca537035f3f565957c64923a65
parent 224244 2df073cb512c562a9b74d40858db73bef0ff511f
child 295257 380817d573cdfbfc4a4b4a4647cf1a53bb52c3b9
permissions -rw-r--r--
Bug 1164594 - Part 2b New Tab menu shouldn't use text-transform: uppercase [r=Mardak]

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

this.EXPORTED_SYMBOLS = ["CloudSync"];

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "Adapters",
                                  "resource://gre/modules/CloudSyncAdapters.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Local",
                                  "resource://gre/modules/CloudSyncLocal.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Bookmarks",
                                  "resource://gre/modules/CloudSyncBookmarks.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Tabs",
                                  "resource://gre/modules/CloudSyncTabs.jsm");

let API_VERSION = 1;

let _CloudSync = function () {
};

_CloudSync.prototype = {
  _adapters: null,

  get adapters () {
    if (!this._adapters) {
      this._adapters = new Adapters();
    }
    return this._adapters;
  },

  _bookmarks: null,

  get bookmarks () {
    if (!this._bookmarks) {
      this._bookmarks = new Bookmarks();
    }
    return this._bookmarks;
  },

  _local: null,

  get local () {
    if (!this._local) {
      this._local = new Local();
    }
    return this._local;
  },

  _tabs: null,

  get tabs () {
    if (!this._tabs) {
      this._tabs = new Tabs();
    }
    return this._tabs;
  },

  get tabsReady () {
    return this._tabs ? true: false;
  },

  get version () {
    return API_VERSION;
  },
};

this.CloudSync = function CloudSync () {
  return _cloudSyncInternal.instance;
};

Object.defineProperty(CloudSync, "ready", {
  get: function () {
    return _cloudSyncInternal.ready;
  }
});

let _cloudSyncInternal = {
  instance: null,
  ready: false,
};

XPCOMUtils.defineLazyGetter(_cloudSyncInternal, "instance", function () {
  _cloudSyncInternal.ready = true;
  return new _CloudSync();
}.bind(this));