Thursday, June 16, 2011

Working with Chrome file browser handler

image00.jpg

During the day 2 keynote of Google I/O, I was excited to see Box's integration with the Chromebook's file browser handler getting demoed on the big stage. The integration makes local files and files you encounter on the web easily accessible to cloud services inside Chrome OS.

Chrome's file browser handler utilizes the new HTML5 file system API, designed to enable web applications to interact with local files. This API lets web applications read files, edit files, and create new files within a designated local space on a user's machine. This includes creating binary files for application data, and in Box's case, accessing user-created files to let people easily move their content to the cloud.
As mentioned during the Google I/O keynote, the integration between Box and the Chrome OS file browser handler only took our team a weekend to build. We were able to build the integration quickly because of the simplicity of both Chrome's file browser platform and Box's API, both of which were designed to make content integrations like this easy for developers to implement.

In this case, the Quick Importer tool from the Box API made the entire development process just a few steps:

1. We created a Chrome extension manifest to work with Box.

{
 "name”: "Box Uploader",
 ...
 "file_browser_handlers": [
     {
      "id”: "upload",
      "default_title": "Save to Gallery", // What the button will display
      "file_filters": [
       ]
     }
   ],

2. In the Chrome manifest, we specified the relevant file types to which the service applies. In our case, that's most file types, as seen below. Specialized services may just want certain types, such as images for Picasa.

"file_browser_handlers": [
     {
      "id": "upload",
      "default_title": "Save to Box",
      "file_filters": [
       "filesystem:*.*"
       ]
     }
   ],

Read more: Google code blog