use of org.chromium.ui.base.WindowAndroid in project AndroidChromium by JackyAndroid.
the class AppBannerInfoBarDelegateAndroid method createIntentCallback.
private WindowAndroid.IntentCallback createIntentCallback(final AppData appData) {
return new WindowAndroid.IntentCallback() {
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode, ContentResolver contentResolver, Intent data) {
boolean isInstalling = resultCode == Activity.RESULT_OK;
if (isInstalling) {
// Start monitoring the install.
PackageManager pm = getPackageManager(ContextUtils.getApplicationContext());
mInstallTask = new InstallerDelegate(Looper.getMainLooper(), pm, createInstallerDelegateObserver(), appData.packageName());
mInstallTask.start();
}
nativeOnInstallIntentReturned(mNativePointer, isInstalling);
}
};
}
use of org.chromium.ui.base.WindowAndroid in project AndroidChromium by JackyAndroid.
the class PaymentRequestFactory method createImpl.
@Override
public PaymentRequest createImpl() {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS)) {
return new InvalidPaymentRequest();
}
if (mWebContents == null)
return new InvalidPaymentRequest();
ContentViewCore contentViewCore = ContentViewCore.fromWebContents(mWebContents);
if (contentViewCore == null)
return new InvalidPaymentRequest();
WindowAndroid window = contentViewCore.getWindowAndroid();
if (window == null)
return new InvalidPaymentRequest();
Activity context = window.getActivity().get();
if (context == null)
return new InvalidPaymentRequest();
if (mIsPaymentRequestRunning)
return new InvalidPaymentRequest();
mIsPaymentRequestRunning = true;
return new PaymentRequestImpl(context, mWebContents, this);
}
use of org.chromium.ui.base.WindowAndroid in project AndroidChromium by JackyAndroid.
the class ShareServiceImpl method activityFromWebContents.
@Nullable
private static Activity activityFromWebContents(@Nullable WebContents webContents) {
if (webContents == null)
return null;
ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
if (contentViewCore == null)
return null;
WindowAndroid window = contentViewCore.getWindowAndroid();
if (window == null)
return null;
return window.getActivity().get();
}
Aggregations