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 <memory> | 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/base64.h" | 12 #include "base/base64.h" |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
(...skipping 28 matching lines...) Expand all Loading... |
45 constexpr base::FilePath::CharType kRemovableMediaPath[] = | 46 constexpr base::FilePath::CharType kRemovableMediaPath[] = |
46 FILE_PATH_LITERAL("/media/removable"); | 47 FILE_PATH_LITERAL("/media/removable"); |
47 constexpr char kArcRemovableMediaProviderUrl[] = | 48 constexpr char kArcRemovableMediaProviderUrl[] = |
48 "content://org.chromium.arc.removablemediaprovider/"; | 49 "content://org.chromium.arc.removablemediaprovider/"; |
49 constexpr char kAppIdSeparator = '/'; | 50 constexpr char kAppIdSeparator = '/'; |
50 constexpr char kPngDataUrlPrefix[] = "data:image/png;base64,"; | 51 constexpr char kPngDataUrlPrefix[] = "data:image/png;base64,"; |
51 | 52 |
52 // Returns the Mojo interface for ARC Intent Helper, with version |minVersion| | 53 // Returns the Mojo interface for ARC Intent Helper, with version |minVersion| |
53 // or above. If the ARC bridge is not established, returns null. | 54 // or above. If the ARC bridge is not established, returns null. |
54 arc::mojom::IntentHelperInstance* GetArcIntentHelper(Profile* profile, | 55 arc::mojom::IntentHelperInstance* GetArcIntentHelper(Profile* profile, |
55 int min_version) { | 56 uint32_t min_version) { |
56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 57 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
57 | 58 |
58 // File manager in secondary profile cannot access ARC. | 59 // File manager in secondary profile cannot access ARC. |
59 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) | 60 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) |
60 return nullptr; | 61 return nullptr; |
61 | 62 |
62 arc::ArcBridgeService* arc_service = arc::ArcBridgeService::Get(); | 63 arc::ArcBridgeService* arc_service = arc::ArcBridgeService::Get(); |
63 if (!arc_service) | 64 if (!arc_service) |
64 return nullptr; | 65 return nullptr; |
65 | 66 |
66 arc::mojom::IntentHelperInstance* intent_helper_instance = | 67 arc::mojom::IntentHelperInstance* intent_helper_instance = |
67 arc_service->intent_helper_instance(); | 68 arc_service->intent_helper()->instance(); |
68 if (!intent_helper_instance) | 69 if (!intent_helper_instance) |
69 return nullptr; | 70 return nullptr; |
70 | 71 |
71 if (arc_service->intent_helper_version() < min_version) { | 72 if (arc_service->intent_helper()->version() < min_version) { |
72 DLOG(WARNING) << "ARC intent helper instance is too old."; | 73 DLOG(WARNING) << "ARC intent helper instance is too old."; |
73 return nullptr; | 74 return nullptr; |
74 } | 75 } |
75 return intent_helper_instance; | 76 return intent_helper_instance; |
76 } | 77 } |
77 | 78 |
78 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. | 79 // Returns the icon loader that wraps the Mojo interface for ARC Intent Helper. |
79 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { | 80 scoped_refptr<arc::ActivityIconLoader> GetArcActivityIconLoader() { |
80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 81 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
81 | 82 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } else { | 349 } else { |
349 arc_intent_helper->HandleUrlListDeprecated( | 350 arc_intent_helper->HandleUrlListDeprecated( |
350 std::move(urls), AppIdToActivityName(task.app_id)->package_name, | 351 std::move(urls), AppIdToActivityName(task.app_id)->package_name, |
351 StringToArcAction(task.action_id)); | 352 StringToArcAction(task.action_id)); |
352 } | 353 } |
353 return true; | 354 return true; |
354 } | 355 } |
355 | 356 |
356 } // namespace file_tasks | 357 } // namespace file_tasks |
357 } // namespace file_manager | 358 } // namespace file_manager |
OLD | NEW |