unmount.cc revision 116680a4aac90f2aa7413d9095a592090648e557
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 fileapi::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  scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue);
25  return SendEvent(
26      request_id,
27      extensions::api::file_system_provider::OnUnmountRequested::kEventName,
28      values.Pass());
29}
30
31void Unmount::OnSuccess(int /* request_id */,
32                        scoped_ptr<RequestValue> /* result */,
33                        bool /* has_more */) {
34  callback_.Run(base::File::FILE_OK);
35}
36
37void Unmount::OnError(int /* request_id */,
38                      scoped_ptr<RequestValue> /* result */,
39                      base::File::Error error) {
40  callback_.Run(error);
41}
42
43}  // namespace operations
44}  // namespace file_system_provider
45}  // namespace chromeos
46