| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_manager/arc_file_tasks.h" | 5 #include "chrome/browser/chromeos/file_manager/arc_file_tasks.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 bool ExecuteArcTask(Profile* profile, | 312 bool ExecuteArcTask(Profile* profile, |
| 313 const TaskDescriptor& task, | 313 const TaskDescriptor& task, |
| 314 const std::vector<storage::FileSystemURL>& file_urls, | 314 const std::vector<storage::FileSystemURL>& file_urls, |
| 315 const std::vector<std::string>& mime_types) { | 315 const std::vector<std::string>& mime_types) { |
| 316 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 316 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 317 DCHECK_EQ(file_urls.size(), mime_types.size()); | 317 DCHECK_EQ(file_urls.size(), mime_types.size()); |
| 318 | 318 |
| 319 arc::mojom::IntentHelperInstance* const arc_intent_helper = | 319 arc::mojom::IntentHelperInstance* const arc_intent_helper = |
| 320 GetArcIntentHelper(profile, "HandleUrlListDeprecated", | 320 GetArcIntentHelper(profile, "HandleUrlList", |
| 321 kArcIntentHelperVersionWithUrlListSupport); | 321 kArcIntentHelperVersionWithFullActivityName); |
| 322 if (!arc_intent_helper) | 322 if (!arc_intent_helper) |
| 323 return false; | 323 return false; |
| 324 | 324 |
| 325 mojo::Array<arc::mojom::UrlWithMimeTypePtr> urls; | 325 mojo::Array<arc::mojom::UrlWithMimeTypePtr> urls; |
| 326 for (size_t i = 0; i < file_urls.size(); ++i) { | 326 for (size_t i = 0; i < file_urls.size(); ++i) { |
| 327 GURL url; | 327 GURL url; |
| 328 if (!ConvertToArcUrl(file_urls[i].path(), &url)) { | 328 if (!ConvertToArcUrl(file_urls[i].path(), &url)) { |
| 329 LOG(ERROR) << "File on unsuppored path"; | 329 LOG(ERROR) << "File on unsuppored path"; |
| 330 return false; | 330 return false; |
| 331 } | 331 } |
| 332 | 332 |
| 333 arc::mojom::UrlWithMimeTypePtr url_with_type = | 333 arc::mojom::UrlWithMimeTypePtr url_with_type = |
| 334 arc::mojom::UrlWithMimeType::New(); | 334 arc::mojom::UrlWithMimeType::New(); |
| 335 url_with_type->url = url.spec(); | 335 url_with_type->url = url.spec(); |
| 336 url_with_type->mime_type = mime_types[i]; | 336 url_with_type->mime_type = mime_types[i]; |
| 337 urls.push_back(std::move(url_with_type)); | 337 urls.push_back(std::move(url_with_type)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 if (GetArcIntentHelper(profile, "HandleUrlList", | 340 arc_intent_helper->HandleUrlList(std::move(urls), |
| 341 kArcIntentHelperVersionWithFullActivityName)) { | 341 AppIdToActivityName(task.app_id), |
| 342 arc_intent_helper->HandleUrlList(std::move(urls), | 342 StringToArcActionType(task.action_id)); |
| 343 AppIdToActivityName(task.app_id), | |
| 344 StringToArcActionType(task.action_id)); | |
| 345 } else { | |
| 346 arc_intent_helper->HandleUrlListDeprecated( | |
| 347 std::move(urls), AppIdToActivityName(task.app_id)->package_name, | |
| 348 StringToArcActionType(task.action_id)); | |
| 349 } | |
| 350 return true; | 343 return true; |
| 351 } | 344 } |
| 352 | 345 |
| 353 } // namespace file_tasks | 346 } // namespace file_tasks |
| 354 } // namespace file_manager | 347 } // namespace file_manager |
| OLD | NEW |