use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class Profile method onNativeDestroyed.
@CalledByNative
private void onNativeDestroyed() {
mNativeProfileAndroid = 0;
if (mIsOffTheRecord) {
Context context = ContextUtils.getApplicationContext();
CookiesFetcher.deleteCookiesIfNecessary(context);
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class DomDistillerUIUtils method openSettings.
/**
* A static method for native code to call to open the distiller UI settings.
* @param webContents The WebContents containing the distilled content.
*/
@CalledByNative
public static void openSettings(WebContents webContents) {
Activity activity = getActivityFromWebContents(webContents);
if (webContents != null && activity != null) {
RecordUserAction.record("DomDistiller_DistilledPagePrefsOpened");
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.AlertDialogTheme);
builder.setView(DistilledPagePrefsView.create(activity));
builder.show();
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class ChromeDownloadDelegate method requestFileAccess.
@CalledByNative
private void requestFileAccess(final long callbackId) {
if (mTab == null || mTab.getWindowAndroid() == null) {
// TODO(tedchoc): Show toast (only when activity is alive).
DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
return;
}
final String storagePermission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
final Activity activity = mTab.getWindowAndroid().getActivity().get();
if (activity == null) {
DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
} else if (mTab.getWindowAndroid().canRequestPermission(storagePermission)) {
View view = activity.getLayoutInflater().inflate(R.layout.update_permissions_dialog, null);
TextView dialogText = (TextView) view.findViewById(R.id.text);
dialogText.setText(R.string.missing_storage_permission_download_education_text);
final PermissionCallback permissionCallback = new PermissionCallback() {
@Override
public void onRequestPermissionsResult(String[] permissions, int[] grantResults) {
DownloadController.getInstance().onRequestFileAccessResult(callbackId, grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED);
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.AlertDialogTheme).setView(view).setPositiveButton(R.string.infobar_update_permissions_button_text, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (mTab == null) {
dialog.cancel();
return;
}
mTab.getWindowAndroid().requestPermissions(new String[] { storagePermission }, permissionCallback);
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
}
});
builder.create().show();
} else if (!mTab.getWindowAndroid().isPermissionRevokedByPolicy(storagePermission)) {
nativeLaunchPermissionUpdateInfoBar(mTab, storagePermission, callbackId);
} else {
// TODO(tedchoc): Show toast.
DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class PrefServiceBridge method addContentSettingExceptionToList.
@CalledByNative
private static void addContentSettingExceptionToList(ArrayList<ContentSettingException> list, int contentSettingsType, String pattern, int contentSetting, String source) {
ContentSettingException exception = new ContentSettingException(contentSettingsType, pattern, ContentSetting.fromInt(contentSetting), source);
list.add(exception);
}
Aggregations