       callback(file, caller)
     )
 
-  upload: (title, content, callback, caller) ->
+  upload: (title, content) ->
     this.set({title: title, content: content})
 
     if this.get("file")
-      this.update(title, content, callback, caller)
+      this.update(title, content)
+      Promise.resolve('update')
     else
-      this.insert(title, content, 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)->
+      this.insert(title, content)
+      Promise.resolve('insert')
+
+  insert: (title, content) ->
+    that = this
+    gapi.client.load('drive', 'v2')
+      .then () -> that.gdrive.insert(title, content)
+      .then (response) ->
         console.log("insert file")
-        console.log(file)
-        that.set("file", file)
-
-        callback(file, "insert", caller)
-        )
-    )
+        console.log(response.result)
+        that.set("file", response.result)
+
+        Promise.resolve(response.result)
 
   update: (title, content, callback, caller) ->
     that = this

      callback(data)
    )

  insert: (title, content, callback) ->
    multipartRequestBody = this.requestBody(title, content)
    # memo: gapi.client.requestはpromiseも使えるらしい
    # https://developers.google.com/api-client-library/javascript/features/promises
    request = gapi.client.request({
      'path': '/upload/drive/v2/files',
      'method': 'POST',
      'params': {'uploadType': 'multipart'},

  upload: ()->
    title = this.model_handler.getEditorTitle()
    content = this.model_handler.getEditorContent()

    this.model.upload(title, content)
      .then (methodName) =>
        this.alertView.show("info", "Success " + methodName + "!")
      .catch (methodName) =>
        this.alertView.show("danger", "Fail " + methodName + "!")

  updateDocumentLink: ()->
    console.log("update_document_link")
