Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java

Issue 897063004: Open up method in InstallerDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java
index 2428ce5978f949f73804f6d6312316738b0be62a..da59c3747ffea45ac6725cc4459ea529c4e0f351 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/banners/InstallerDelegate.java
@@ -63,7 +63,7 @@ public class InstallerDelegate implements Runnable {
* @param observer Alerted when the package has been completely installed.
* @param packageName Name of the package for the app to monitor.
*/
- InstallerDelegate(
+ public InstallerDelegate(
Looper looper, PackageManager packageManager, Observer observer, String packageName) {
mHandler = new Handler(looper);
mPackageManager = packageManager;
@@ -100,17 +100,27 @@ public class InstallerDelegate implements Runnable {
/**
* Checks if the app has been installed on the system.
+ * @param packageManager PackageManager to use.
+ * @param packageName Name of the package to check.
* @return True if the PackageManager reports that the app is installed, false otherwise.
*/
- private boolean isInstalled() {
- List<PackageInfo> packs = mPackageManager.getInstalledPackages(0);
+ public static boolean isInstalled(PackageManager packageManager, String packageName) {
+ List<PackageInfo> packs = packageManager.getInstalledPackages(0);
for (int i = 0; i < packs.size(); i++) {
- if (TextUtils.equals(packs.get(i).packageName, mPackageName)) return true;
+ if (TextUtils.equals(packs.get(i).packageName, packageName)) return true;
}
return false;
}
/**
+ * Checks if the app has been installed on the system.
+ * @return True if the PackageManager reports that the app is installed, false otherwise.
+ */
+ private boolean isInstalled() {
+ return isInstalled(mPackageManager, mPackageName);
+ }
+
+ /**
* Prevent rescheduling the Runnable.
*/
void cancel() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698