         .addView(view)
         .setAppId(client_id)
         .setOAuthToken(access_token)
+        .setCallback((data) ->
+          if data.action == google.picker.Action.PICKED
+            fileId = data.docs[0].id
+            that.model.fetchFile(fileId, that.fetchFileAlert, that)
+        )
         # .setDeveloperKey(developerKey)
-        .setCallback(that.pickerCallback)
         # .enableFeature(google.picker.Feature.NAV_HIDDEN)
         # .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
         .build()
       console.log(picker)
       picker.setVisible(true)
-
-  pickerCallback: (data)->
-    if data.action == google.picker.Action.PICKED
-      fileId = data.docs[0].id
-      console.log(data.docs[0])
-      # TODO: idは取れたのでそこから読みだして中身を展開する必要がある
 })
 
 module.exports = {

GDriveModel = Backbone.Model.extend({
  initialize: ()->
    this.gdrive = new GDrive()
    this.access_token = null
    this.set('title', '')
    this.set('content', '')
    this.set("client_id", this.gdrive.CLIENT_ID)

  authorize: (callback, caller)->


  insert: (title, content, callback, caller) ->
    that = this
    # memo: gapi.client.loadはGDriveオブジェクトの方に移したい
    # さらにclient.loadはcallback無しのときにpromiseが返るらしい
    # https://developers.google.com/api-client-library/javascript/reference/referencedocs
    gapi.client.load('drive', 'v2', ->
      that.gdrive.insert(title, content, (file)->
        console.log("insert file")
