Interface CefriumChromeClient


@CefriumExperimental public interface CefriumChromeClient
Called on the UI thread. What a page asks of the app around it, like android.webkit.WebChromeClient. Set it with CefriumBrowser.setChromeClient(CefriumChromeClient); every method has a default, so implement only the ones you need. The browser is the first parameter, so one client can serve several browsers.
  • Method Details

    • onTitleChanged

      default void onTitleChanged(CefriumBrowser browser, String title)
      The page's title changed.
    • onFaviconUrlsChanged

      default void onFaviconUrlsChanged(CefriumBrowser browser, List<String> urls)
      The page's icon URLs changed, best first (may be empty). Fetch one with CefriumBrowser.downloadImage(String, int, CefriumBrowser.ImageCallback).
    • onFullscreenChanged

      default void onFullscreenChanged(CefriumBrowser browser, boolean fullscreen)
      The page entered or left fullscreen (element.requestFullscreen()).
    • onConsoleMessage

      default void onConsoleMessage(CefriumBrowser browser, CefriumConsoleMessage message)
      The page wrote to its console.
    • onStatusMessage

      default void onStatusMessage(CefriumBrowser browser, String text)
      The text to show for the link under the pointer; empty when it leaves the link.
    • onMediaAccessChanged

      default void onMediaAccessChanged(CefriumBrowser browser, boolean camera, boolean microphone)
      The page started or stopped using the camera or the microphone.
    • onFindResult

      default void onFindResult(CefriumBrowser browser, int activeMatch, int matches)
      A result of CefriumBrowser.find(String, boolean, boolean, boolean): the active match (1-based, 0 when none) and the number of matches.
    • onJsDialog

      default boolean onJsDialog(CefriumBrowser browser, CefriumJsDialogType type, String message, String defaultText, CefriumBrowser.JsDialogCallback callback)
      A page opened alert(), confirm() or prompt(). Return true to show your own dialog and answer through callback (now or later, from any thread; the first answer counts): success is OK, userInput the prompt's text. Return false for the engine's own dialog. The page waits until there is an answer.
      Parameters:
      defaultText - a prompt's initial text, empty otherwise
    • onBeforeUnloadDialog

      default boolean onBeforeUnloadDialog(CefriumBrowser browser, String message, boolean isReload, CefriumBrowser.JsDialogCallback callback)
      A page asks whether to leave it (beforeunload, for example a form with unsaved changes). Return true to ask the user and answer through callback: success leaves the page. Return false to leave without asking.
      Parameters:
      isReload - whether the page is being reloaded rather than left
    • onShowFileChooser

      default boolean onShowFileChooser(CefriumBrowser browser, CefriumFileChooserParams params, CefriumFileChooserCallback callback)
      A file input (<input type=file>) asks for files. Return true to show your own chooser and answer through callback; params.createIntent() gives the system picker's intent. Return false for the SDK's chooser: the engine's on a surface browser (camera, photo picker, filtered by accept), the system picker on an off-screen browser's dialog activity.
    • onContextMenu

      default boolean onContextMenu(CefriumBrowser browser, CefriumContextMenu menu)
      The page asks for a context menu (a long press or a right click on a link or an image). Return true to show your own and answer through menu. Return false to leave it to a context-menu listener set the old way, or to close it.
    • shouldOverrideKeyEvent

      default boolean shouldOverrideKeyEvent(CefriumBrowser browser, android.view.KeyEvent event)
      A key is about to reach the page. Return true to take it yourself: the page does not get it. Like WebViewClient.shouldOverrideKeyEvent, with the Android key code and meta state. Keys an input method composes (no key code of their own) are not reported.
    • onUnhandledKeyEvent

      default void onUnhandledKeyEvent(CefriumBrowser browser, android.view.KeyEvent event)
      The page did not handle a key (no preventDefault), so the app may: for example a shortcut. Like WebViewClient.onUnhandledKeyEvent.
    • onCreateWindow

      default boolean onCreateWindow(CefriumBrowser browser, CefriumBrowser popup, String url, boolean userGesture)
      The page opened a window (window.open, target=_blank). popup is a new browser in this browser's mode and profile that loads url as that window: the page keeps window.opener, so a sign-in popup can post its result back. Show it (its surface container, or its frames off-screen) and return true; it is yours to close. Return false and it is closed: then a PopupHandler set the old way decides, and without one the URL loads in this browser. Like WebChromeClient.onCreateWindow.
    • onCloseWindow

      default void onCloseWindow(CefriumBrowser browser, CefriumBrowser popup)
      A window from onCreateWindow(CefriumBrowser, CefriumBrowser, String, boolean) called window.close(): remove it from the UI. It closes itself.
    • onPermissionRequest

      default void onPermissionRequest(CefriumBrowser browser, CefriumPermissionRequest request)
      A page asks for permissions. Answer with request.grant() or request.deny(), now or later (after asking the user). The default denies.

      Some requests never get here because the platform refuses them first: geolocation when the app does not hold the location permission or location is off, clipboard reads from a page that is not focused (an off-screen browser needs CefriumBrowser.setFocus(boolean)), and any permission of a page with an opaque origin (CefriumBrowser.loadHtml(String)).

    • onPermissionRequestCanceled

      default void onPermissionRequestCanceled(CefriumBrowser browser, CefriumPermissionRequest request)
      A request that was not answered yet is no longer wanted (the page navigated away): close any prompt shown for it. Answering it now does nothing.