Search in sources :

Example 6 with WindowAndroid

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);
        }
    };
}
Also used : PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent) WindowAndroid(org.chromium.ui.base.WindowAndroid) InstallerDelegate(org.chromium.chrome.browser.banners.InstallerDelegate) ContentResolver(android.content.ContentResolver)

Example 7 with WindowAndroid

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);
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) Activity(android.app.Activity) WindowAndroid(org.chromium.ui.base.WindowAndroid)

Example 8 with WindowAndroid

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();
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) WindowAndroid(org.chromium.ui.base.WindowAndroid) Nullable(android.support.annotation.Nullable)

Aggregations

WindowAndroid (org.chromium.ui.base.WindowAndroid)8 ContentViewCore (org.chromium.content.browser.ContentViewCore)4 Activity (android.app.Activity)2 Intent (android.content.Intent)2 CalledByNative (org.chromium.base.annotations.CalledByNative)2 ContentResolver (android.content.ContentResolver)1 PackageManager (android.content.pm.PackageManager)1 Uri (android.net.Uri)1 Nullable (android.support.annotation.Nullable)1 ActivityStateListener (org.chromium.base.ApplicationStatus.ActivityStateListener)1 InstallerDelegate (org.chromium.chrome.browser.banners.InstallerDelegate)1 LocationUtils (org.chromium.components.location.LocationUtils)1 PermissionCallback (org.chromium.ui.base.WindowAndroid.PermissionCallback)1