From 8c530e9291721083ba11746fc5b3da66dc692120 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 5 Feb 2012 10:42:58 -0800 Subject: Setting up IO Ninja Library This class will be used to copy locally the library needed for Ninja's IO. --- js/io/system/chromeapi.js | 49 +++++++++++++++++++++++++++++++++++++++++++- js/io/system/coreioapi.js | 6 ++++++ js/io/system/fileio.js | 13 ++++++++++++ js/io/system/ninjalibrary.js | 29 ++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 js/io/system/ninjalibrary.js (limited to 'js') diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js index d1ff6da3..04e62b11 100644 --- a/js/io/system/chromeapi.js +++ b/js/io/system/chromeapi.js @@ -7,6 +7,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot /* ///////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// NOTES: + The init function starts up the file system API, and a size must be + set, no unlimited available as of now. //////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// */ // @@ -24,9 +26,11 @@ exports.ChromeApi = Montage.create(Object.prototype, { //Current way to init Chrome's fileSystem API window.webkitRequestFileSystem(window.PERSISTENT, size*1024*1024, function (fs) { this.fileSystem = fs; - }).bind(this); + }.bind(this)); + return true; } else { //No fileSystem API + return false; } } }, @@ -46,6 +50,49 @@ exports.ChromeApi = Montage.create(Object.prototype, { set: function(value) { this._fileSystem = value; } + }, + //////////////////////////////////////////////////////////////////// + // + directoryNew: { + enumerable: true, + value: function() { + } + }, + + //////////////////////////////////////////////////////////////////// + // + directoryDelete: {//TODO: Make sure it uses a force delete + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + directoryContents: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + directoryCopy: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + directoryRename: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + directoryMove: { + enumerable: true, + value: function() { + } } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index c34e0736..73d9fa76 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js @@ -28,6 +28,12 @@ exports.CoreIoApi = Montage.create(Component, { //////////////////////////////////////////////////////////// //Getting reference of chrome file system API this.chromeFileSystem = ChromeApi; + //Sending size in MBs for file system storage + if (this.chromeFileSystem.init(20)) { + //Available + } else { + //Not available + } //////////////////////////////////////////////////////////// //Checking for local storage of URL for IO if (window.localStorage['ioRootUrl']) { diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js index 355812da..2c49e849 100755 --- a/js/io/system/fileio.js +++ b/js/io/system/fileio.js @@ -91,6 +91,19 @@ exports.FileIo = Montage.create(Object.prototype, { }, //////////////////////////////////////////////////////////////////// // + deleteFile: { + enumerable: true, + value: function() { + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; + } + // + } + }, + //////////////////////////////////////////////////////////////////// + // copyFile: { enumerable: true, value: function() { diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js new file mode 100644 index 00000000..3f8585ed --- /dev/null +++ b/js/io/system/ninjalibrary.js @@ -0,0 +1,29 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +/* ///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +NOTES: +//////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////// */ +// +var Montage = require("montage/core/core").Montage; +//////////////////////////////////////////////////////////////////////// +// +exports.NinjaLibrary = Montage.create(Object.prototype, { + //////////////////////////////////////////////////////////////////// + // + init: { + enumerable: true, + value: function() { + // + } + } + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// +}); +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3