yueying0083 / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Adds CefSchemeHandler to be able to create own schemes #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This issue is an enhancement of JCEF - STEP 3  (patch 7 of 10) 
--------------------------------------------------------------
Please see issue 55 for the overall plan.

Purpose: Adds CefSchemeHandler to be able to create own schemes

This patch relies on the attached patch file of  issue #85. 
If you want to try these code changes, add the patch of issue #85 first and 
afterwards add the patch file attached to this issue. Otherwise you'll get some 
patch-errors.

Brief overview (only important changes are listed):
---------------------------------------------------
This patch adds the following classes to JCEF:
  package org.cef.callback
    CefSchemeHandlerFactory
    CefSchemeRegistrar

And adds the following methods to existing classes:
  package org.cef
    CefApp
       boolean registerSchemeHandlerFactory(String schemeName, String domainName, CefSchemeHandlerFactory factory)
       boolean clearSchemeHandlerFactories()

  package org.cef.handler
    CefAppHandler
      void onRegisterCustomSchemes(CefSchemeRegistrar registrar)
      void onContextInitialized()

Added Tests to MainFrame example application:
---------------------------------------------
- MainFrame registers two schemes: "search://" and "client://"
- (1) Enter "search://search something" into the address-field and press 
<Enter> (or the Go-Button)
  -> "search something" is forwarded to google as search request
- (2) Enter any non-URL text into the address-field. This text is extended by 
the scheme "search://"
      and handled like in (1) described
- Menu > Bookmarks > Scheme-Handler Test 1: (scheme "client")
- Menu > Bookmarks > Scheme-Handler Test 2: (scheme "search")

Notes:
------
Please add the attached file "logo.png" manually to the directory 
"src/java/tests/detailed/handler".
The file is required for the example and not included in the patch file itself.
The file has to be added to the SVN as well. 

The second patch file of this issue (7b) adds a CEF application icon to the Mac 
apps
so that the two created app bundles look somewhat nicer. Same here: please add 
the 
file "CefIcon.icns" manually to the directory "src/third_party/cef/res".
The file is required by the ANT build target (build.xml) and not included in 
the patch file itself.
The file has to be added to the SVN as well. 

Original issue reported on code.google.com by k...@censhare.de on 14 May 2014 at 2:16

Attachments:

GoogleCodeExporter commented 9 years ago
One additional patch file.

Please assign 07_2015-05-12_added_CefSchemeHandler.patch first and afterwards 
this attached patch file (07c).

It changes the behavior of how the logo.png is read within class 
tests.detailed.handler.ClientSchemeHandler.
This is required because (on Mac) the image is stored within a JAR archive and 
can't be accessed directly.

Original comment by k...@censhare.de on 21 May 2014 at 9:09

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 23 May 2014 at 6:31

GoogleCodeExporter commented 9 years ago
Added in revision 67.

There's one minor issue: Entering "search://search something" in the address 
bar initiates a search for "somethin" -- seems the last character is being 
truncated.

Original comment by magreenb...@gmail.com on 23 May 2014 at 7:40

GoogleCodeExporter commented 9 years ago
@comment #3: Yes you are right. 
And there is a second one: If you enter for example "http://localhost" you're 
not forwarded to your web server listening on "localhost". Instead the URL is 
extended by "search://" and forwarded to google…

Both issues are fixed within the patch file.

Original comment by k...@censhare.de on 28 May 2014 at 7:20

GoogleCodeExporter commented 9 years ago
Here is the patch file to comment #4

Original comment by k...@censhare.de on 28 May 2014 at 7:46

Attachments:

GoogleCodeExporter commented 9 years ago
@#5: Thanks, added in revision 77.

Original comment by magreenb...@gmail.com on 17 Jun 2014 at 4:41