| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "chrome/common/extensions/api/file_system_provider.h" | 11 #include "chrome/common/extensions/api/file_system_provider.h" |
| 12 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 12 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 namespace file_system_provider { | 15 namespace file_system_provider { |
| 16 namespace operations { | 16 namespace operations { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Convert the request |value| into a list of actions. | 19 // Convert the request |value| into a list of actions. |
| 20 Actions ConvertRequestValueToActions(scoped_ptr<RequestValue> value) { | 20 Actions ConvertRequestValueToActions(std::unique_ptr<RequestValue> value) { |
| 21 using extensions::api::file_system_provider_internal:: | 21 using extensions::api::file_system_provider_internal:: |
| 22 GetActionsRequestedSuccess::Params; | 22 GetActionsRequestedSuccess::Params; |
| 23 | 23 |
| 24 const Params* params = value->get_actions_success_params(); | 24 const Params* params = value->get_actions_success_params(); |
| 25 DCHECK(params); | 25 DCHECK(params); |
| 26 | 26 |
| 27 Actions result; | 27 Actions result; |
| 28 for (const auto& idl_action : params->actions) { | 28 for (const auto& idl_action : params->actions) { |
| 29 Action action; | 29 Action action; |
| 30 action.id = idl_action.id; | 30 action.id = idl_action.id; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 return SendEvent( | 61 return SendEvent( |
| 62 request_id, | 62 request_id, |
| 63 extensions::events::FILE_SYSTEM_PROVIDER_ON_GET_ACTIONS_REQUESTED, | 63 extensions::events::FILE_SYSTEM_PROVIDER_ON_GET_ACTIONS_REQUESTED, |
| 64 extensions::api::file_system_provider::OnGetActionsRequested::kEventName, | 64 extensions::api::file_system_provider::OnGetActionsRequested::kEventName, |
| 65 extensions::api::file_system_provider::OnGetActionsRequested::Create( | 65 extensions::api::file_system_provider::OnGetActionsRequested::Create( |
| 66 options)); | 66 options)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void GetActions::OnSuccess(int /* request_id */, | 69 void GetActions::OnSuccess(int /* request_id */, |
| 70 scoped_ptr<RequestValue> result, | 70 std::unique_ptr<RequestValue> result, |
| 71 bool has_more) { | 71 bool has_more) { |
| 72 callback_.Run(ConvertRequestValueToActions(std::move(result)), | 72 callback_.Run(ConvertRequestValueToActions(std::move(result)), |
| 73 base::File::FILE_OK); | 73 base::File::FILE_OK); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void GetActions::OnError(int /* request_id */, | 76 void GetActions::OnError(int /* request_id */, |
| 77 scoped_ptr<RequestValue> /* result */, | 77 std::unique_ptr<RequestValue> /* result */, |
| 78 base::File::Error error) { | 78 base::File::Error error) { |
| 79 callback_.Run(Actions(), error); | 79 callback_.Run(Actions(), error); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace operations | 82 } // namespace operations |
| 83 } // namespace file_system_provider | 83 } // namespace file_system_provider |
| 84 } // namespace chromeos | 84 } // namespace chromeos |
| OLD | NEW |