1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" 6 7#include "base/values.h" 8#include "chrome/common/extensions/api/file_system_provider.h" 9 10namespace chromeos { 11namespace file_system_provider { 12namespace operations { 13 14Unmount::Unmount(extensions::EventRouter* event_router, 15 const ProvidedFileSystemInfo& file_system_info, 16 const storage::AsyncFileUtil::StatusCallback& callback) 17 : Operation(event_router, file_system_info), callback_(callback) { 18} 19 20Unmount::~Unmount() { 21} 22 23bool Unmount::Execute(int request_id) { 24 using extensions::api::file_system_provider::UnmountRequestedOptions; 25 26 UnmountRequestedOptions options; 27 options.file_system_id = file_system_info_.file_system_id(); 28 options.request_id = request_id; 29 30 return SendEvent( 31 request_id, 32 extensions::api::file_system_provider::OnUnmountRequested::kEventName, 33 extensions::api::file_system_provider::OnUnmountRequested::Create( 34 options)); 35} 36 37void Unmount::OnSuccess(int /* request_id */, 38 scoped_ptr<RequestValue> /* result */, 39 bool /* has_more */) { 40 callback_.Run(base::File::FILE_OK); 41} 42 43void Unmount::OnError(int /* request_id */, 44 scoped_ptr<RequestValue> /* result */, 45 base::File::Error error) { 46 callback_.Run(error); 47} 48 49} // namespace operations 50} // namespace file_system_provider 51} // namespace chromeos 52