Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 namespace arc { | 30 namespace arc { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // Default sizes to use. | 34 // Default sizes to use. |
| 35 constexpr int kNexus7Width = 960; | 35 constexpr int kNexus7Width = 960; |
| 36 constexpr int kNexus7Height = 600; | 36 constexpr int kNexus7Height = 600; |
| 37 constexpr int kNexus5Width = 410; | 37 constexpr int kNexus5Width = 410; |
| 38 constexpr int kNexus5Height = 690; | 38 constexpr int kNexus5Height = 690; |
| 39 | 39 |
| 40 // Minimum required versions. | 40 // Minimum required versions. |
|
Yusuke Sato
2017/01/04 19:59:12
Same. Can you remove these?
| |
| 41 constexpr uint32_t kMinVersion = 0; | 41 constexpr uint32_t kMinVersion = 0; |
| 42 constexpr uint32_t kCanHandleResolutionMinVersion = 1; | 42 constexpr uint32_t kCanHandleResolutionMinVersion = 1; |
| 43 constexpr uint32_t kSendBroadcastMinVersion = 1; | 43 constexpr uint32_t kSendBroadcastMinVersion = 1; |
| 44 constexpr uint32_t kUninstallPackageMinVersion = 2; | 44 constexpr uint32_t kUninstallPackageMinVersion = 2; |
| 45 constexpr uint32_t kTaskSupportMinVersion = 3; | 45 constexpr uint32_t kTaskSupportMinVersion = 3; |
| 46 constexpr uint32_t kShowPackageInfoMinVersion = 5; | 46 constexpr uint32_t kShowPackageInfoMinVersion = 5; |
| 47 constexpr uint32_t kRemoveIconMinVersion = 9; | 47 constexpr uint32_t kRemoveIconMinVersion = 9; |
| 48 constexpr uint32_t kShowPackageInfoOnPageMinVersion = 10; | 48 constexpr uint32_t kShowPackageInfoOnPageMinVersion = 10; |
| 49 | 49 |
| 50 // Service name strings. | 50 // Service name strings. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 70 // happens. | 70 // happens. |
| 71 arc::mojom::AppInstance* GetAppInstance(uint32_t required_version, | 71 arc::mojom::AppInstance* GetAppInstance(uint32_t required_version, |
| 72 const std::string& service_name) { | 72 const std::string& service_name) { |
| 73 auto* arc_service_manager = arc::ArcServiceManager::Get(); | 73 auto* arc_service_manager = arc::ArcServiceManager::Get(); |
| 74 if (!arc_service_manager) { | 74 if (!arc_service_manager) { |
| 75 VLOG(2) << "Request to " << service_name | 75 VLOG(2) << "Request to " << service_name |
| 76 << " when bridge service is not ready."; | 76 << " when bridge service is not ready."; |
| 77 return nullptr; | 77 return nullptr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 return arc_service_manager->arc_bridge_service()->app()->GetInstanceForMethod( | 80 return arc_service_manager->arc_bridge_service() |
| 81 service_name, required_version); | 81 ->app() |
| 82 ->GetInstanceForVersion(required_version, service_name.c_str()); | |
| 82 } | 83 } |
| 83 | 84 |
| 84 // Helper function which returns the IntentHelperInstance. Create related logs | 85 // Helper function which returns the IntentHelperInstance. Create related logs |
| 85 // when error happens. | 86 // when error happens. |
| 86 arc::mojom::IntentHelperInstance* GetIntentHelperInstance( | 87 arc::mojom::IntentHelperInstance* GetIntentHelperInstance( |
| 87 uint32_t required_version, | 88 uint32_t required_version, |
| 88 const std::string& service_name) { | 89 const std::string& service_name) { |
| 89 auto* arc_service_manager = arc::ArcServiceManager::Get(); | 90 auto* arc_service_manager = arc::ArcServiceManager::Get(); |
| 90 if (!arc_service_manager) { | 91 if (!arc_service_manager) { |
| 91 VLOG(2) << "Request to " << service_name | 92 VLOG(2) << "Request to " << service_name |
| 92 << " when bridge service is not ready."; | 93 << " when bridge service is not ready."; |
| 93 return nullptr; | 94 return nullptr; |
| 94 } | 95 } |
| 95 | 96 |
| 96 return arc_service_manager->arc_bridge_service() | 97 return arc_service_manager->arc_bridge_service() |
| 97 ->intent_helper() | 98 ->intent_helper() |
| 98 ->GetInstanceForMethod(service_name, required_version); | 99 ->GetInstanceForVersion(required_version, service_name.c_str()); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void PrioritizeArcInstanceCallback(bool success) { | 102 void PrioritizeArcInstanceCallback(bool success) { |
| 102 VLOG(2) << "Finished prioritizing the instance: result=" << success; | 103 VLOG(2) << "Finished prioritizing the instance: result=" << success; |
| 103 if (!success) | 104 if (!success) |
| 104 LOG(ERROR) << "Failed to prioritize ARC"; | 105 LOG(ERROR) << "Failed to prioritize ARC"; |
| 105 } | 106 } |
| 106 | 107 |
| 107 // Find a proper size and position for a given rectangle on the screen. | 108 // Find a proper size and position for a given rectangle on the screen. |
| 108 // TODO(skuhne): This needs more consideration, but it is lacking | 109 // TODO(skuhne): This needs more consideration, but it is lacking |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 return false; | 461 return false; |
| 461 | 462 |
| 462 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); | 463 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); |
| 463 if (!arc_prefs) | 464 if (!arc_prefs) |
| 464 return false; | 465 return false; |
| 465 | 466 |
| 466 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); | 467 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); |
| 467 } | 468 } |
| 468 | 469 |
| 469 } // namespace arc | 470 } // namespace arc |
| OLD | NEW |