| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 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 kCanHandleResolutionMinVersion = 1; |
| 31 constexpr int kMinVersion = 0; | 32 constexpr int kMinVersion = 0; |
| 32 constexpr int kCanHandleResolutionMinVersion = 1; | |
| 33 constexpr int kShowPackageInfoMinVersion = 5; | 33 constexpr int kShowPackageInfoMinVersion = 5; |
| 34 constexpr int kShowPackageInfoOnPageMinVersion = 8; |
| 34 constexpr int kUninstallPackageMinVersion = 2; | 35 constexpr int kUninstallPackageMinVersion = 2; |
| 35 | 36 |
| 36 // Service name strings. | 37 // Service name strings. |
| 37 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; | 38 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; |
| 38 constexpr char kLaunchAppStr[] = "launch app"; | 39 constexpr char kLaunchAppStr[] = "launch app"; |
| 39 constexpr char kShowPackageInfoStr[] = "show package info"; | 40 constexpr char kShowPackageInfoStr[] = "show package info"; |
| 40 constexpr char kUninstallPackageStr[] = "uninstall package"; | 41 constexpr char kUninstallPackageStr[] = "uninstall package"; |
| 41 | 42 |
| 42 // Helper function which returns the AppInstance. Create related logs when error | 43 // Helper function which returns the AppInstance. Create related logs when error |
| 43 // happens. | 44 // happens. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 VLOG(2) << "Uninstalling " << package_name; | 251 VLOG(2) << "Uninstalling " << package_name; |
| 251 | 252 |
| 252 arc::mojom::AppInstance* app_instance = | 253 arc::mojom::AppInstance* app_instance = |
| 253 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr); | 254 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr); |
| 254 if (!app_instance) | 255 if (!app_instance) |
| 255 return; | 256 return; |
| 256 | 257 |
| 257 app_instance->UninstallPackage(package_name); | 258 app_instance->UninstallPackage(package_name); |
| 258 } | 259 } |
| 259 | 260 |
| 261 // Deprecated. |
| 260 bool ShowPackageInfo(const std::string& package_name) { | 262 bool ShowPackageInfo(const std::string& package_name) { |
| 261 VLOG(2) << "Showing package info for " << package_name; | 263 VLOG(2) << "Showing package info for " << package_name; |
| 262 | 264 |
| 263 arc::mojom::AppInstance* app_instance = | 265 arc::mojom::AppInstance* app_instance = |
| 264 GetAppInstance(kShowPackageInfoMinVersion, kShowPackageInfoStr); | 266 GetAppInstance(kShowPackageInfoMinVersion, kShowPackageInfoStr); |
| 265 if (!app_instance) | 267 if (!app_instance) |
| 266 return false; | 268 return false; |
| 267 | 269 |
| 268 app_instance->ShowPackageInfo( | 270 app_instance->ShowPackageInfoDeprecated( |
| 269 package_name, GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 271 package_name, GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
| 270 return true; | 272 return true; |
| 271 } | 273 } |
| 272 | 274 |
| 275 bool ShowPackageInfoOnPage(const std::string& package_name, |
| 276 mojom::ShowPackageInfoPage page) { |
| 277 VLOG(2) << "Showing package info for " << package_name; |
| 278 |
| 279 arc::mojom::AppInstance* app_instance = |
| 280 GetAppInstance(kShowPackageInfoOnPageMinVersion, kShowPackageInfoStr); |
| 281 if (!app_instance) |
| 282 return false; |
| 283 |
| 284 app_instance->ShowPackageInfoOnPage( |
| 285 package_name, page, |
| 286 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
| 287 return true; |
| 288 } |
| 289 |
| 273 } // namespace arc | 290 } // namespace arc |
| OLD | NEW |