Chromium Code Reviews| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/strings/utf_string_conversions.h" | |
| 13 #include "chrome/browser/chromeos/drive/file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 14 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 15 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 16 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 16 #include "chrome/browser/extensions/api/file_handlers/directory_util.h" | 17 #include "chrome/browser/extensions/api/file_handlers/directory_util.h" |
| 17 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" | 18 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/common/extensions/api/file_manager_private.h" | 20 #include "chrome/common/extensions/api/file_manager_private.h" |
| 20 #include "chrome/common/extensions/api/file_manager_private_internal.h" | 21 #include "chrome/common/extensions/api/file_manager_private_internal.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "extensions/browser/entry_info.h" | 23 #include "extensions/browser/entry_info.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 191 |
| 191 // Convert the tasks into JSON compatible objects. | 192 // Convert the tasks into JSON compatible objects. |
| 192 using api::file_manager_private::FileTask; | 193 using api::file_manager_private::FileTask; |
| 193 std::vector<FileTask> results; | 194 std::vector<FileTask> results; |
| 194 for (const file_manager::file_tasks::FullTaskDescriptor& task : tasks) { | 195 for (const file_manager::file_tasks::FullTaskDescriptor& task : tasks) { |
| 195 FileTask converted; | 196 FileTask converted; |
| 196 converted.task_id = | 197 converted.task_id = |
| 197 file_manager::file_tasks::TaskDescriptorToId(task.task_descriptor()); | 198 file_manager::file_tasks::TaskDescriptorToId(task.task_descriptor()); |
| 198 if (!task.icon_url().is_empty()) | 199 if (!task.icon_url().is_empty()) |
| 199 converted.icon_url = task.icon_url().spec(); | 200 converted.icon_url = task.icon_url().spec(); |
| 200 converted.title = task.task_title(); | 201 // TODO(cmihail): Does this conversion really work? |
| 202 converted.title = base::UTF16ToUTF8(task.task_title()); | |
|
fukino
2016/04/11 09:19:43
Just a question: Why should be convert task title
cmihail
2016/04/13 07:36:46
Unfortunately IDL doesn't allow me to pass a UTF16
fukino
2016/04/13 08:03:12
Sorry! I'm not familiar with internationalization
mtomasz
2016/04/13 09:17:06
I think internationalization in C++ is OK.
| |
| 201 converted.is_default = task.is_default(); | 203 converted.is_default = task.is_default(); |
| 202 converted.is_generic_file_handler = task.is_generic_file_handler(); | 204 converted.is_generic_file_handler = task.is_generic_file_handler(); |
| 203 results.push_back(std::move(converted)); | 205 results.push_back(std::move(converted)); |
| 204 } | 206 } |
| 205 | 207 |
| 206 results_ = extensions::api::file_manager_private_internal::GetFileTasks:: | 208 results_ = extensions::api::file_manager_private_internal::GetFileTasks:: |
| 207 Results::Create(results); | 209 Results::Create(results); |
| 208 SendResponse(true); | 210 SendResponse(true); |
| 209 } | 211 } |
| 210 | 212 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 232 SetResult(new base::FundamentalValue(true)); | 234 SetResult(new base::FundamentalValue(true)); |
| 233 return true; | 235 return true; |
| 234 } | 236 } |
| 235 | 237 |
| 236 file_manager::file_tasks::UpdateDefaultTask( | 238 file_manager::file_tasks::UpdateDefaultTask( |
| 237 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); | 239 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); |
| 238 return true; | 240 return true; |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |