| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Default sizes to use. | 24 // Default sizes to use. |
| 25 constexpr int kNexus7Width = 960; | 25 constexpr int kNexus7Width = 960; |
| 26 constexpr int kNexus7Height = 600; | 26 constexpr int kNexus7Height = 600; |
| 27 constexpr int kNexus5Width = 410; | 27 constexpr int kNexus5Width = 410; |
| 28 constexpr int kNexus5Height = 690; | 28 constexpr int kNexus5Height = 690; |
| 29 | 29 |
| 30 // Minimum required versions. | 30 // Minimum required versions. |
| 31 constexpr int kMinVersion = 0; | 31 constexpr int kMinVersion = 0; |
| 32 constexpr int kCanHandleResolutionMinVersion = 1; | 32 constexpr int kCanHandleResolutionMinVersion = 1; |
| 33 constexpr int kUninstallPackageMinVersion = 2; |
| 33 constexpr int kShowPackageInfoMinVersion = 5; | 34 constexpr int kShowPackageInfoMinVersion = 5; |
| 34 constexpr int kUninstallPackageMinVersion = 2; | |
| 35 constexpr int kRemoveIconMinVersion = 9; | 35 constexpr int kRemoveIconMinVersion = 9; |
| 36 constexpr int kShowPackageInfoOnPageMinVersion = 11; |
| 36 | 37 |
| 37 // Service name strings. | 38 // Service name strings. |
| 38 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; | 39 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; |
| 39 constexpr char kLaunchAppStr[] = "launch app"; | 40 constexpr char kLaunchAppStr[] = "launch app"; |
| 40 constexpr char kShowPackageInfoStr[] = "show package info"; | 41 constexpr char kShowPackageInfoStr[] = "show package info"; |
| 41 constexpr char kUninstallPackageStr[] = "uninstall package"; | 42 constexpr char kUninstallPackageStr[] = "uninstall package"; |
| 42 constexpr char kRemoveIconStr[] = "remove icon"; | 43 constexpr char kRemoveIconStr[] = "remove icon"; |
| 43 | 44 |
| 44 // Helper function which returns the AppInstance. Create related logs when error | 45 // Helper function which returns the AppInstance. Create related logs when error |
| 45 // happens. | 46 // happens. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 VLOG(2) << "Removing icon " << icon_resource_id; | 268 VLOG(2) << "Removing icon " << icon_resource_id; |
| 268 | 269 |
| 269 arc::mojom::AppInstance* app_instance = | 270 arc::mojom::AppInstance* app_instance = |
| 270 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); | 271 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); |
| 271 if (!app_instance) | 272 if (!app_instance) |
| 272 return; | 273 return; |
| 273 | 274 |
| 274 app_instance->RemoveCachedIcon(icon_resource_id); | 275 app_instance->RemoveCachedIcon(icon_resource_id); |
| 275 } | 276 } |
| 276 | 277 |
| 278 // Deprecated. |
| 277 bool ShowPackageInfo(const std::string& package_name) { | 279 bool ShowPackageInfo(const std::string& package_name) { |
| 278 VLOG(2) << "Showing package info for " << package_name; | 280 VLOG(2) << "Showing package info for " << package_name; |
| 279 | 281 |
| 280 arc::mojom::AppInstance* app_instance = | 282 arc::mojom::AppInstance* app_instance = |
| 281 GetAppInstance(kShowPackageInfoMinVersion, kShowPackageInfoStr); | 283 GetAppInstance(kShowPackageInfoMinVersion, kShowPackageInfoStr); |
| 282 if (!app_instance) | 284 if (!app_instance) |
| 283 return false; | 285 return false; |
| 284 | 286 |
| 285 app_instance->ShowPackageInfo( | 287 app_instance->ShowPackageInfoDeprecated( |
| 286 package_name, GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 288 package_name, GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
| 287 return true; | 289 return true; |
| 288 } | 290 } |
| 289 | 291 |
| 292 bool ShowPackageInfoOnPage(const std::string& package_name, |
| 293 mojom::ShowPackageInfoPage page) { |
| 294 VLOG(2) << "Showing package info for " << package_name; |
| 295 |
| 296 arc::mojom::AppInstance* app_instance = |
| 297 GetAppInstance(kShowPackageInfoOnPageMinVersion, kShowPackageInfoStr); |
| 298 if (!app_instance) |
| 299 return false; |
| 300 |
| 301 app_instance->ShowPackageInfoOnPage( |
| 302 package_name, page, |
| 303 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
| 304 return true; |
| 305 } |
| 306 |
| 290 } // namespace arc | 307 } // namespace arc |
| OLD | NEW |