Elim cr-checkbox
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / operations / execute_action.h
blobf6739279cb05a98b041878a4c76d8cffcc2aeea7
1 // Copyright 2015 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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_EXECUTE_ACTION_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_EXECUTE_ACTION_H_
8 #include <string>
10 #include "base/files/file.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
15 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
16 #include "chrome/common/extensions/api/file_system_provider_internal.h"
17 #include "storage/browser/fileapi/async_file_util.h"
19 namespace base {
20 class FilePath;
21 } // namespace base
23 namespace extensions {
24 class EventRouter;
25 } // namespace extensions
27 namespace chromeos {
28 namespace file_system_provider {
29 namespace operations {
31 // Bridge between chrome.fileManagerPrivate.executeEntryAction operation and
32 // the providing extension's onExecuteActionRequested event. Created per
33 // request.
34 class ExecuteAction : public Operation {
35 public:
36 ExecuteAction(extensions::EventRouter* event_router,
37 const ProvidedFileSystemInfo& file_system_info,
38 const base::FilePath& entry_path,
39 const std::string& action_id,
40 const storage::AsyncFileUtil::StatusCallback& callback);
41 ~ExecuteAction() override;
43 // Operation overrides.
44 bool Execute(int request_id) override;
45 void OnSuccess(int request_id,
46 scoped_ptr<RequestValue> result,
47 bool has_more) override;
48 void OnError(int request_id,
49 scoped_ptr<RequestValue> result,
50 base::File::Error error) override;
52 private:
53 const base::FilePath entry_path_;
54 const std::string action_id_;
55 const storage::AsyncFileUtil::StatusCallback callback_;
57 DISALLOW_COPY_AND_ASSIGN(ExecuteAction);
60 } // namespace operations
61 } // namespace file_system_provider
62 } // namespace chromeos
64 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_EXECUTE_ACTION_H_