| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.chrome.browser.infobar; | 5 package org.chromium.chrome.browser.infobar; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.ActivityNotFoundException; | 8 import android.content.ActivityNotFoundException; |
| 9 import android.content.ContentResolver; | |
| 10 import android.content.Context; | 9 import android.content.Context; |
| 11 import android.content.Intent; | 10 import android.content.Intent; |
| 12 import android.content.pm.PackageManager; | 11 import android.content.pm.PackageManager; |
| 13 import android.os.Looper; | 12 import android.os.Looper; |
| 14 | 13 |
| 15 import org.chromium.base.ApplicationStatus; | 14 import org.chromium.base.ApplicationStatus; |
| 16 import org.chromium.base.ContextUtils; | 15 import org.chromium.base.ContextUtils; |
| 17 import org.chromium.base.Log; | 16 import org.chromium.base.Log; |
| 18 import org.chromium.base.ThreadUtils; | 17 import org.chromium.base.ThreadUtils; |
| 19 import org.chromium.base.VisibleForTesting; | 18 import org.chromium.base.VisibleForTesting; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } catch (ActivityNotFoundException e) { | 117 } catch (ActivityNotFoundException e) { |
| 119 Log.e(TAG, "Failed to open app : %s!", packageName, e); | 118 Log.e(TAG, "Failed to open app : %s!", packageName, e); |
| 120 return; | 119 return; |
| 121 } | 120 } |
| 122 } | 121 } |
| 123 } | 122 } |
| 124 | 123 |
| 125 private WindowAndroid.IntentCallback createIntentCallback(final AppData appD
ata) { | 124 private WindowAndroid.IntentCallback createIntentCallback(final AppData appD
ata) { |
| 126 return new WindowAndroid.IntentCallback() { | 125 return new WindowAndroid.IntentCallback() { |
| 127 @Override | 126 @Override |
| 128 public void onIntentCompleted(WindowAndroid window, int resultCode, | 127 public void onIntentCompleted( |
| 129 ContentResolver contentResolver, Intent data) { | 128 WindowAndroid window, int resultCode, Context context, Inten
t data) { |
| 130 boolean isInstalling = resultCode == Activity.RESULT_OK; | 129 boolean isInstalling = resultCode == Activity.RESULT_OK; |
| 131 if (isInstalling) { | 130 if (isInstalling) { |
| 132 // Start monitoring the install. | 131 // Start monitoring the install. |
| 133 PackageManager pm = | 132 PackageManager pm = |
| 134 getPackageManager(ContextUtils.getApplicationContext
()); | 133 getPackageManager(ContextUtils.getApplicationContext
()); |
| 135 mInstallTask = new InstallerDelegate( | 134 mInstallTask = new InstallerDelegate( |
| 136 Looper.getMainLooper(), pm, createInstallerDelegateO
bserver(), | 135 Looper.getMainLooper(), pm, createInstallerDelegateO
bserver(), |
| 137 appData.packageName()); | 136 appData.packageName()); |
| 138 mInstallTask.start(); | 137 mInstallTask.start(); |
| 139 } | 138 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 private static AppBannerInfoBarDelegateAndroid create(long nativePtr) { | 215 private static AppBannerInfoBarDelegateAndroid create(long nativePtr) { |
| 217 return new AppBannerInfoBarDelegateAndroid(nativePtr); | 216 return new AppBannerInfoBarDelegateAndroid(nativePtr); |
| 218 } | 217 } |
| 219 | 218 |
| 220 private native void nativeOnInstallIntentReturned( | 219 private native void nativeOnInstallIntentReturned( |
| 221 long nativeAppBannerInfoBarDelegateAndroid, boolean isInstalling); | 220 long nativeAppBannerInfoBarDelegateAndroid, boolean isInstalling); |
| 222 private native void nativeOnInstallFinished( | 221 private native void nativeOnInstallFinished( |
| 223 long nativeAppBannerInfoBarDelegateAndroid, boolean success); | 222 long nativeAppBannerInfoBarDelegateAndroid, boolean success); |
| 224 private native void nativeUpdateInstallState(long nativeAppBannerInfoBarDele
gateAndroid); | 223 private native void nativeUpdateInstallState(long nativeAppBannerInfoBarDele
gateAndroid); |
| 225 } | 224 } |
| OLD | NEW |