Package org.cef

Class CefApp

    • Method Detail

      • addAppHandler

        public static void addAppHandler​(CefAppHandler appHandler)
                                  throws java.lang.IllegalStateException
        Assign an AppHandler to CefApp. The AppHandler can be used to evaluate application arguments, to register your own schemes and to hook into the shutdown sequence. See CefAppHandler for more details. This method must be called before CefApp is initialized. CefApp will be initialized automatically if you call createClient() the first time.
        Parameters:
        appHandler - An instance of CefAppHandler.
        Throws:
        java.lang.IllegalStateException - in case of CefApp is already initialized
      • getInstance

        public static CefApp getInstance()
                                  throws java.lang.UnsatisfiedLinkError
        Get an instance of this class.
        Returns:
        an instance of this class
        Throws:
        java.lang.UnsatisfiedLinkError
      • getInstance

        public static CefApp getInstance​(java.lang.String[] args)
                                  throws java.lang.UnsatisfiedLinkError
        Throws:
        java.lang.UnsatisfiedLinkError
      • getInstance

        public static CefApp getInstance​(CefSettings settings)
                                  throws java.lang.UnsatisfiedLinkError
        Throws:
        java.lang.UnsatisfiedLinkError
      • getInstance

        public static CefApp getInstance​(java.lang.String[] args,
                                         CefSettings settings)
                                  throws java.lang.UnsatisfiedLinkError
        Throws:
        java.lang.UnsatisfiedLinkError
      • setSettings

        public final void setSettings​(CefSettings settings)
                               throws java.lang.IllegalStateException
        Throws:
        java.lang.IllegalStateException
      • getState

        public static final CefApp.CefAppState getState()
        Returns the current state of CefApp.
        Returns:
        current state.
      • dispose

        public final void dispose()
        To shutdown the system, it's important to call the dispose method. Calling this method closes all client instances with and all browser instances each client owns. After that the message loop is terminated and CEF is shutdown.
      • createClient

        public CefClient createClient()
        Creates a new client instance and returns it to the caller. One client instance is responsible for one to many browser instances
        Returns:
        a new client instance
      • registerSchemeHandlerFactory

        public boolean registerSchemeHandlerFactory​(java.lang.String schemeName,
                                                    java.lang.String domainName,
                                                    CefSchemeHandlerFactory factory)
        Register a scheme handler factory for the specified |scheme_name| and optional |domain_name|. An empty |domain_name| value for a standard scheme will cause the factory to match all domain names. The |domain_name| value will be ignored for non-standard schemes. If |scheme_name| is a built-in scheme and no handler is returned by |factory| then the built-in scheme handler factory will be called. If |scheme_name| is a custom scheme then also implement the CefApp::OnRegisterCustomSchemes() method in all processes. This function may be called multiple times to change or remove the factory that matches the specified |scheme_name| and optional |domain_name|. Returns false if an error occurs. This function may be called on any thread in the browser process.
      • clearSchemeHandlerFactories

        public boolean clearSchemeHandlerFactories()
        Clear all registered scheme handler factories. Returns false on error. This function may be called on any thread in the browser process.
      • clientWasDisposed

        protected final void clientWasDisposed​(CefClient client)
        This method is called by a CefClient if it was disposed. This causes CefApp to clean up its list of available client instances. If all clients are disposed, CefApp will be shutdown.
        Parameters:
        client - the disposed client.
      • handleBeforeTerminate

        protected final void handleBeforeTerminate()
        This method is invoked by the native code (currently on Mac only) in case of a termination event (e.g. someone pressed CMD+Q).
      • doMessageLoopWork

        public final void doMessageLoopWork​(long delay_ms)
        Perform a single message loop iteration. Used on all platforms except Windows with windowed rendering.
      • startup

        public static final boolean startup​(java.lang.String[] args)
        This method must be called at the beginning of the main() method to perform platform- specific startup initialization. On Linux this initializes Xlib multithreading and on macOS this dynamically loads the CEF framework.
        Parameters:
        args - Command-line arguments massed to main().
        Returns:
        True on successful startup.