Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / operations / unmount.cc
blob92c0155e1fc68b4875617aa9e4d53dc3fd09fac0
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.
5 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h"
7 #include "base/values.h"
8 #include "chrome/common/extensions/api/file_system_provider.h"
10 namespace chromeos {
11 namespace file_system_provider {
12 namespace operations {
14 Unmount::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) {
20 Unmount::~Unmount() {
23 bool Unmount::Execute(int request_id) {
24 using extensions::api::file_system_provider::UnmountRequestedOptions;
26 UnmountRequestedOptions options;
27 options.file_system_id = file_system_info_.file_system_id();
28 options.request_id = request_id;
30 return SendEvent(
31 request_id, extensions::events::FILE_SYSTEM_PROVIDER_ON_UNMOUNT_REQUESTED,
32 extensions::api::file_system_provider::OnUnmountRequested::kEventName,
33 extensions::api::file_system_provider::OnUnmountRequested::Create(
34 options));
37 void Unmount::OnSuccess(int /* request_id */,
38 scoped_ptr<RequestValue> /* result */,
39 bool /* has_more */) {
40 callback_.Run(base::File::FILE_OK);
43 void Unmount::OnError(int /* request_id */,
44 scoped_ptr<RequestValue> /* result */,
45 base::File::Error error) {
46 callback_.Run(error);
49 } // namespace operations
50 } // namespace file_system_provider
51 } // namespace chromeos