| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 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 return arc::ArcIntentHelperBridge::GetIntentHelperInstance(min_version); |
| 62 arc::ArcBridgeService* arc_service = arc::ArcBridgeService::Get(); | |
| 63 if (!arc_service) | |
| 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 } | 62 } |
| 77 | 63 |
| 78 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. | 64 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. |
| 79 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { | 65 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { |
| 80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 81 | 67 |
| 82 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); | 68 arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get(); |
| 83 if (!arc_service_manager) | 69 if (!arc_service_manager) |
| 84 return nullptr; | 70 return nullptr; |
| 85 return arc_service_manager->icon_loader(); | 71 return arc_service_manager->icon_loader(); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } else { | 339 } else { |
| 354 arc_intent_helper->HandleUrlListDeprecated( | 340 arc_intent_helper->HandleUrlListDeprecated( |
| 355 std::move(urls), AppIdToActivityName(task.app_id)->package_name, | 341 std::move(urls), AppIdToActivityName(task.app_id)->package_name, |
| 356 StringToArcAction(task.action_id)); | 342 StringToArcAction(task.action_id)); |
| 357 } | 343 } |
| 358 return true; | 344 return true; |
| 359 } | 345 } |
| 360 | 346 |
| 361 } // namespace file_tasks | 347 } // namespace file_tasks |
| 362 } // namespace file_manager | 348 } // namespace file_manager |
| OLD | NEW |