OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/file_system_provider/operations/get_actions.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/get_actions.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/common/extensions/api/file_system_provider.h" | 10 #include "chrome/common/extensions/api/file_system_provider.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 return result; | 34 return result; |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 GetActions::GetActions( | 39 GetActions::GetActions( |
40 extensions::EventRouter* event_router, | 40 extensions::EventRouter* event_router, |
41 const ProvidedFileSystemInfo& file_system_info, | 41 const ProvidedFileSystemInfo& file_system_info, |
42 const base::FilePath& entry_path, | 42 const std::vector<base::FilePath>& entry_paths, |
43 const ProvidedFileSystemInterface::GetActionsCallback& callback) | 43 const ProvidedFileSystemInterface::GetActionsCallback& callback) |
44 : Operation(event_router, file_system_info), | 44 : Operation(event_router, file_system_info), |
45 entry_path_(entry_path), | 45 entry_paths_(entry_paths), |
46 callback_(callback) { | 46 callback_(callback) {} |
47 } | |
48 | 47 |
49 GetActions::~GetActions() { | 48 GetActions::~GetActions() { |
50 } | 49 } |
51 | 50 |
52 bool GetActions::Execute(int request_id) { | 51 bool GetActions::Execute(int request_id) { |
53 using extensions::api::file_system_provider::GetActionsRequestedOptions; | 52 using extensions::api::file_system_provider::GetActionsRequestedOptions; |
54 | 53 |
55 GetActionsRequestedOptions options; | 54 GetActionsRequestedOptions options; |
56 options.file_system_id = file_system_info_.file_system_id(); | 55 options.file_system_id = file_system_info_.file_system_id(); |
57 options.request_id = request_id; | 56 options.request_id = request_id; |
58 options.entry_path = entry_path_.AsUTF8Unsafe(); | 57 for (const auto& entry_path : entry_paths_) |
| 58 options.entry_paths.push_back(entry_path.AsUTF8Unsafe()); |
59 | 59 |
60 return SendEvent( | 60 return SendEvent( |
61 request_id, | 61 request_id, |
62 extensions::events::FILE_SYSTEM_PROVIDER_ON_GET_ACTIONS_REQUESTED, | 62 extensions::events::FILE_SYSTEM_PROVIDER_ON_GET_ACTIONS_REQUESTED, |
63 extensions::api::file_system_provider::OnGetActionsRequested::kEventName, | 63 extensions::api::file_system_provider::OnGetActionsRequested::kEventName, |
64 extensions::api::file_system_provider::OnGetActionsRequested::Create( | 64 extensions::api::file_system_provider::OnGetActionsRequested::Create( |
65 options)); | 65 options)); |
66 } | 66 } |
67 | 67 |
68 void GetActions::OnSuccess(int /* request_id */, | 68 void GetActions::OnSuccess(int /* request_id */, |
69 scoped_ptr<RequestValue> result, | 69 scoped_ptr<RequestValue> result, |
70 bool has_more) { | 70 bool has_more) { |
71 callback_.Run(ConvertRequestValueToActions(result.Pass()), | 71 callback_.Run(ConvertRequestValueToActions(result.Pass()), |
72 base::File::FILE_OK); | 72 base::File::FILE_OK); |
73 } | 73 } |
74 | 74 |
75 void GetActions::OnError(int /* request_id */, | 75 void GetActions::OnError(int /* request_id */, |
76 scoped_ptr<RequestValue> /* result */, | 76 scoped_ptr<RequestValue> /* result */, |
77 base::File::Error error) { | 77 base::File::Error error) { |
78 callback_.Run(Actions(), error); | 78 callback_.Run(Actions(), error); |
79 } | 79 } |
80 | 80 |
81 } // namespace operations | 81 } // namespace operations |
82 } // namespace file_system_provider | 82 } // namespace file_system_provider |
83 } // namespace chromeos | 83 } // namespace chromeos |
OLD | NEW |