Ido Green (@greenido)
May 31, 2011
goo.gl/P6OWs
What should I create?
{
"name" : "Todo List",
"description" : "The amazing Todo list - help you getting things done",
"version": "0.0.1",
"icons": {
"24": "logo-24.png",
"128": "logo-128.png"
},
"permissions": [
"unlimitedStorage", "notification"
],
"app" : {
"urls": ["http://best-apps4.me/todo/"],
"launch": {
"web_url": "http://best-apps4.me/todo/index.html"
}
}
}
Provide store content
Provide store content
Provide store content
Use chrome.fileBrowserHandler module to extend the Chrome OS file browser.
Declare the "fileBrowserHandler" permission in the extension manifest.
{
"name": "Upload to flickr",
...
"file_browser_handlers": [
{
"id": "upload",
"default_title": "Save to flickr", // What the button will display
"file_filters": [
"filesystem:*.jpg",
"filesystem:*.jpeg",
"filesystem:*.png"
]
}
],
"permissions" : [
"fileBrowserHandler"
],
"icons": { "16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png" }
}
uploadFile: function(file) {
var pro1 = document.querySelector('#pro1');
var progressBar = pro1.querySelector('progress');
var formData = new FormData();
formData.append('file', file);
var xhr = new XMLHttpRequest();
xhr.open('POST', this.uploadServer, true);
xhr.onload = function(e) {
if (this.status == 200) {
console.log(this.response);
alert("The image is safe in Flickr " + this.response);
}
};
xhr.onerror = function(e) {
console.log(this, this.status, this.responseText,
this.getAllResponseHeaders())
};
xhr.send(formData);
},
...