| 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(scoped_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; |
| 31 action.title = idl_action->title.get() ? *idl_action->title : std::string(); | 31 action.title = idl_action.title.get() ? *idl_action.title : std::string(); |
| 32 result.push_back(action); | 32 result.push_back(action); |
| 33 } | 33 } |
| 34 | 34 |
| 35 return result; | 35 return result; |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 GetActions::GetActions( | 40 GetActions::GetActions( |
| 41 extensions::EventRouter* event_router, | 41 extensions::EventRouter* event_router, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void GetActions::OnError(int /* request_id */, | 76 void GetActions::OnError(int /* request_id */, |
| 77 scoped_ptr<RequestValue> /* result */, | 77 scoped_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 |