| 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 <vector> | 10 #include <vector> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Returns the Mojo interface for ARC Intent Helper, with version |minVersion| | 52 // Returns the Mojo interface for ARC Intent Helper, with version |minVersion| |
| 53 // or above. If the ARC bridge is not established, returns null. | 53 // or above. If the ARC bridge is not established, returns null. |
| 54 arc::mojom::IntentHelperInstance* GetArcIntentHelper(Profile* profile, | 54 arc::mojom::IntentHelperInstance* GetArcIntentHelper(Profile* profile, |
| 55 uint32_t min_version) { | 55 uint32_t min_version) { |
| 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 57 | 57 |
| 58 // File manager in secondary profile cannot access ARC. | 58 // File manager in secondary profile cannot access ARC. |
| 59 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) | 59 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) |
| 60 return nullptr; | 60 return nullptr; |
| 61 | 61 |
| 62 arc::ArcBridgeService* arc_service = arc::ArcBridgeService::Get(); | 62 return arc::ArcIntentHelperBridge::GetIntentHelperInstance(min_version, |
| 63 if (!arc_service) | 63 nullptr); |
| 64 return nullptr; | |
| 65 | |
| 66 arc::mojom::IntentHelperInstance* intent_helper_instance = | |
| 67 arc_service->intent_helper()->instance(); | |
| 68 if (!intent_helper_instance) | |
| 69 return nullptr; | |
| 70 | |
| 71 if (arc_service->intent_helper()->version() < min_version) { | |
| 72 DLOG(WARNING) << "ARC intent helper instance is too old."; | |
| 73 return nullptr; | |
| 74 } | |
| 75 return intent_helper_instance; | |
| 76 } | 64 } |
| 77 | 65 |
| 78 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. | 66 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. |
| 79 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { | 67 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { |
| 80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 68 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 81 | 69 |
| 82 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); | 70 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); |
| 83 if (!arc_service_manager) | 71 if (!arc_service_manager) |
| 84 return nullptr; | 72 return nullptr; |
| 85 return arc_service_manager->icon_loader(); | 73 return arc_service_manager->icon_loader(); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } else { | 341 } else { |
| 354 arc_intent_helper->HandleUrlListDeprecated( | 342 arc_intent_helper->HandleUrlListDeprecated( |
| 355 std::move(urls), AppIdToActivityName(task.app_id)->package_name, | 343 std::move(urls), AppIdToActivityName(task.app_id)->package_name, |
| 356 StringToArcAction(task.action_id)); | 344 StringToArcAction(task.action_id)); |
| 357 } | 345 } |
| 358 return true; | 346 return true; |
| 359 } | 347 } |
| 360 | 348 |
| 361 } // namespace file_tasks | 349 } // namespace file_tasks |
| 362 } // namespace file_manager | 350 } // namespace file_manager |
| OLD | NEW |