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 "chrome/browser/chromeos/extensions/file_manager/file_tasks.h" | 7 #include "chrome/browser/chromeos/extensions/file_manager/file_tasks.h" |
8 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" | 8 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" |
9 #include "chrome/browser/chromeos/extensions/file_manager/mime_util.h" | 9 #include "chrome/browser/chromeos/extensions/file_manager/mime_util.h" |
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 file_urls.push_back(file_url); | 177 file_urls.push_back(file_url); |
178 file_paths.push_back(file_path); | 178 file_paths.push_back(file_path); |
179 | 179 |
180 // If MIME type is not provided, guess it from the file path. | 180 // If MIME type is not provided, guess it from the file path. |
181 if (mime_type.empty()) | 181 if (mime_type.empty()) |
182 mime_type = util::GetMimeTypeForPath(file_path); | 182 mime_type = util::GetMimeTypeForPath(file_path); |
183 | 183 |
184 path_mime_set.insert(std::make_pair(file_path, mime_type)); | 184 path_mime_set.insert(std::make_pair(file_path, mime_type)); |
185 } | 185 } |
186 | 186 |
187 ListValue* result_list = new ListValue(); | 187 std::vector<file_tasks::FullTaskDescriptor> tasks; |
188 SetResult(result_list); | |
189 | |
190 file_tasks::FindAllTypesOfTasks(profile_, | 188 file_tasks::FindAllTypesOfTasks(profile_, |
191 path_mime_set, | 189 path_mime_set, |
192 file_urls, | 190 file_urls, |
193 file_paths, | 191 file_paths, |
194 result_list); | 192 &tasks); |
193 // Conver the tasks into JSON format. | |
kinaba
2013/08/29 09:33:35
nit: Convert
satorux1
2013/08/30 02:01:34
Done.
| |
194 ListValue* result_list = new ListValue(); | |
195 for (size_t i = 0; i < tasks.size(); ++i) | |
196 result_list->Append(tasks[i].AsDictionaryValue().release()); | |
197 | |
198 SetResult(result_list); | |
195 SendResponse(true); | 199 SendResponse(true); |
196 return true; | 200 return true; |
197 } | 201 } |
198 | 202 |
199 SetDefaultTaskFunction::SetDefaultTaskFunction() { | 203 SetDefaultTaskFunction::SetDefaultTaskFunction() { |
200 } | 204 } |
201 | 205 |
202 SetDefaultTaskFunction::~SetDefaultTaskFunction() { | 206 SetDefaultTaskFunction::~SetDefaultTaskFunction() { |
203 } | 207 } |
204 | 208 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 | 245 |
242 file_tasks::UpdateDefaultTask(profile_->GetPrefs(), | 246 file_tasks::UpdateDefaultTask(profile_->GetPrefs(), |
243 task_id, | 247 task_id, |
244 suffixes, | 248 suffixes, |
245 mime_types); | 249 mime_types); |
246 | 250 |
247 return true; | 251 return true; |
248 } | 252 } |
249 | 253 |
250 } // namespace file_manager | 254 } // namespace file_manager |
OLD | NEW |