| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/file_manager/private_api_tasks.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 file_manager::file_tasks::FindAllTypesOfTasks( | 186 file_manager::file_tasks::FindAllTypesOfTasks( |
| 187 GetProfile(), drive::util::GetDriveAppRegistryByProfile(GetProfile()), | 187 GetProfile(), drive::util::GetDriveAppRegistryByProfile(GetProfile()), |
| 188 entries, urls_, | 188 entries, urls_, |
| 189 base::Bind( | 189 base::Bind( |
| 190 &FileManagerPrivateInternalGetFileTasksFunction::OnFileTasksListed, | 190 &FileManagerPrivateInternalGetFileTasksFunction::OnFileTasksListed, |
| 191 this)); | 191 this)); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void FileManagerPrivateInternalGetFileTasksFunction::OnFileTasksListed( | 194 void FileManagerPrivateInternalGetFileTasksFunction::OnFileTasksListed( |
| 195 const std::vector<file_manager::file_tasks::FullTaskDescriptor>& tasks) { | 195 std::unique_ptr<std::vector<file_manager::file_tasks::FullTaskDescriptor>> |
| 196 tasks) { |
| 196 // Convert the tasks into JSON compatible objects. | 197 // Convert the tasks into JSON compatible objects. |
| 197 using api::file_manager_private::FileTask; | 198 using api::file_manager_private::FileTask; |
| 198 std::vector<FileTask> results; | 199 std::vector<FileTask> results; |
| 199 for (const file_manager::file_tasks::FullTaskDescriptor& task : tasks) { | 200 for (const file_manager::file_tasks::FullTaskDescriptor& task : *tasks) { |
| 200 FileTask converted; | 201 FileTask converted; |
| 201 converted.task_id = | 202 converted.task_id = |
| 202 file_manager::file_tasks::TaskDescriptorToId(task.task_descriptor()); | 203 file_manager::file_tasks::TaskDescriptorToId(task.task_descriptor()); |
| 203 if (!task.icon_url().is_empty()) | 204 if (!task.icon_url().is_empty()) |
| 204 converted.icon_url = task.icon_url().spec(); | 205 converted.icon_url = task.icon_url().spec(); |
| 205 converted.title = task.task_title(); | 206 converted.title = task.task_title(); |
| 206 converted.is_default = task.is_default(); | 207 converted.is_default = task.is_default(); |
| 207 converted.is_generic_file_handler = task.is_generic_file_handler(); | 208 converted.is_generic_file_handler = task.is_generic_file_handler(); |
| 208 results.push_back(std::move(converted)); | 209 results.push_back(std::move(converted)); |
| 209 } | 210 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 237 SetResult(new base::FundamentalValue(true)); | 238 SetResult(new base::FundamentalValue(true)); |
| 238 return true; | 239 return true; |
| 239 } | 240 } |
| 240 | 241 |
| 241 file_manager::file_tasks::UpdateDefaultTask( | 242 file_manager::file_tasks::UpdateDefaultTask( |
| 242 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); | 243 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); |
| 243 return true; | 244 return true; |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace extensions | 247 } // namespace extensions |
| OLD | NEW |