use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class LocationSettings method canSitesRequestLocationPermission.
@CalledByNative
private static boolean canSitesRequestLocationPermission(WebContents webContents) {
ContentViewCore cvc = ContentViewCore.fromWebContents(webContents);
if (cvc == null)
return false;
WindowAndroid windowAndroid = cvc.getWindowAndroid();
if (windowAndroid == null)
return false;
LocationUtils locationUtils = LocationUtils.getInstance();
if (!locationUtils.isSystemLocationSettingEnabled())
return false;
return locationUtils.hasAndroidLocationPermission() || windowAndroid.canRequestPermission(Manifest.permission.ACCESS_FINE_LOCATION);
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class DownloadManagerService method addDownloadItemToList.
@CalledByNative
private void addDownloadItemToList(List<DownloadItem> list, String guid, String displayName, String filepath, String url, String mimeType, long startTimestamp, long totalBytes, boolean hasBeenExternallyRemoved) {
// Remap the MIME type first.
File file = new File(filepath);
String newMimeType = ChromeDownloadDelegate.remapGenericMimeType(mimeType, url, file.getName());
list.add(createDownloadItem(guid, displayName, filepath, url, newMimeType, startTimestamp, totalBytes, hasBeenExternallyRemoved));
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class AppBannerInfoBarDelegateAndroid method installOrOpenNativeApp.
@CalledByNative
private boolean installOrOpenNativeApp(Tab tab, AppData appData, String referrer) {
Context context = ContextUtils.getApplicationContext();
String packageName = appData.packageName();
PackageManager packageManager = getPackageManager(context);
if (InstallerDelegate.isInstalled(packageManager, packageName)) {
// Open the app.
openApp(context, packageName);
return true;
} else {
// Try installing the app. If the installation was kicked off, return false to prevent
// the infobar from disappearing.
// The supplied referrer is the URL of the page requesting the native app banner. It
// may be empty depending on that page's referrer policy. If it is non-empty, attach it
// to the installation intent as Intent.EXTRA_REFERRER.
Intent installIntent = appData.installIntent();
if (referrer.length() > 0)
installIntent.putExtra(Intent.EXTRA_REFERRER, referrer);
return !tab.getWindowAndroid().showIntent(installIntent, createIntentCallback(appData), null);
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class AppBannerInfoBarDelegateAndroid method openWebApk.
@CalledByNative
private void openWebApk(String packageName) {
Context context = ContextUtils.getApplicationContext();
PackageManager packageManager = getPackageManager(context);
if (InstallerDelegate.isInstalled(packageManager, packageName)) {
mWebApkPackage = null;
openApp(context, packageName);
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class AutoSigninSnackbarController method showSnackbar.
/**
* Displays Auto sign-in snackbar, which communicates to the users that they
* were signed in to the web site.
*/
@CalledByNative
private static void showSnackbar(Tab tab, String text) {
SnackbarManager snackbarManager = tab.getSnackbarManager();
if (snackbarManager == null)
return;
AutoSigninSnackbarController snackbarController = new AutoSigninSnackbarController(snackbarManager, tab);
Snackbar snackbar = Snackbar.make(text, snackbarController, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_AUTO_LOGIN);
Resources resources = tab.getWindowAndroid().getActivity().get().getResources();
int backgroundColor = ApiCompatibilityUtils.getColor(resources, R.color.light_active_color);
Bitmap icon = BitmapFactory.decodeResource(resources, R.drawable.account_management_no_picture);
snackbar.setSingleLine(false).setBackgroundColor(backgroundColor).setProfileImage(icon);
snackbarManager.showSnackbar(snackbar);
}
Aggregations