Search in sources :

Example 56 with CalledByNative

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();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Activity(android.app.Activity) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 57 with CalledByNative

use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.

the class MinidumpUploadService method tryUploadCrashDumpWithLocalId.

/**
     * Attempts to upload the crash report with the given local ID.
     *
     * Note that this method is asynchronous. All that is guaranteed is that
     * upload attempts will be enqueued.
     *
     * This method is safe to call from the UI thread.
     *
     * @param context the context to use for the intent.
     * @param localId The local ID of the crash report.
     */
@CalledByNative
public static void tryUploadCrashDumpWithLocalId(Context context, String localId) {
    Intent intent = new Intent(context, MinidumpUploadService.class);
    intent.setAction(ACTION_FORCE_UPLOAD);
    intent.putExtra(LOCAL_CRASH_ID_KEY, localId);
    context.startService(intent);
}
Also used : Intent(android.content.Intent) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 58 with CalledByNative

use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.

the class ContextMenuHelper method showContextMenu.

/**
     * Starts showing a context menu for {@code view} based on {@code params}.
     * @param contentViewCore The {@link ContentViewCore} to show the menu to.
     * @param params          The {@link ContextMenuParams} that indicate what menu items to show.
     */
@CalledByNative
private void showContextMenu(ContentViewCore contentViewCore, ContextMenuParams params) {
    final View view = contentViewCore.getContainerView();
    if (view == null || view.getVisibility() != View.VISIBLE || view.getParent() == null) {
        return;
    }
    mCurrentContextMenuParams = params;
    view.setOnCreateContextMenuListener(this);
    if (view.showContextMenu()) {
        WebContents webContents = contentViewCore.getWebContents();
        RecordHistogram.recordBooleanHistogram("ContextMenu.Shown", webContents != null);
    }
}
Also used : WebContents(org.chromium.content_public.browser.WebContents) View(android.view.View) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 59 with CalledByNative

use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.

the class ContextMenuHelper method onShareImageReceived.

@CalledByNative
private void onShareImageReceived(WindowAndroid windowAndroid, byte[] jpegImageData) {
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null)
        return;
    ShareHelper.shareImage(activity, jpegImageData);
}
Also used : Activity(android.app.Activity) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 60 with CalledByNative

use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.

the class ContextualSearchManager method onIcingSelectionAvailable.

/**
     * Called by native code when a selection is available to share with Icing (for Conversational
     * Search).
     */
@CalledByNative
private void onIcingSelectionAvailable(final String encoding, final String surroundingText, int startOffset, int endOffset) {
    GSAContextDisplaySelection selection = new GSAContextDisplaySelection(encoding, surroundingText, startOffset, endOffset);
    mSearchPanel.setWasSelectionPartOfUrl(ContextualSearchSelectionController.isSelectionPartOfUrl(surroundingText, startOffset, endOffset));
    notifyShowContextualSearch(selection);
}
Also used : GSAContextDisplaySelection(org.chromium.chrome.browser.gsa.GSAContextDisplaySelection) CalledByNative(org.chromium.base.annotations.CalledByNative)

Aggregations

CalledByNative (org.chromium.base.annotations.CalledByNative)74 Activity (android.app.Activity)11 Context (android.content.Context)11 Intent (android.content.Intent)10 CastMediaRouteProvider (org.chromium.chrome.browser.media.router.cast.CastMediaRouteProvider)8 DownloadNotifier (org.chromium.chrome.browser.download.DownloadNotifier)6 View (android.view.View)5 TextView (android.widget.TextView)5 DownloadInfo (org.chromium.chrome.browser.download.DownloadInfo)5 SuppressLint (android.annotation.SuppressLint)4 PackageManager (android.content.pm.PackageManager)4 Bitmap (android.graphics.Bitmap)4 Paint (android.graphics.Paint)4 ScrollView (android.widget.ScrollView)4 ActivityManager (android.app.ActivityManager)3 ImageView (android.widget.ImageView)3 LinearLayout (android.widget.LinearLayout)3 VisibleForTesting (org.chromium.base.VisibleForTesting)3 Account (android.accounts.Account)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2