GithubHelp home page GithubHelp logo

gurkengewuerz / cefgo Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 3.0 78 KB

Go bindings for the Chromium Embedded Framework (CEF)

License: GNU General Public License v3.0

Go 100.00%
cef chrome golang go chromium gui-toolkit cefgo cgo

cefgo's Introduction

cefgo

These are simple bindings for CEF C API in Go. It's not documented yet, but you can follow the example to figure out how to use. It's pretty simple.
In order to run the examples, the CEF supporting files must be placed beside the executable.

Features

  • JS to Go callbacks
  • Go to JS eval
  • frameless window
  • single and sub executable support
  • Tested on Windows and Linux (macOS should work using seperate processes)
  • window functions (maximize, minimize, show, always on top, etc)
  • application icon

CEF Version and Compatibility

This lib is compiled against CEF 94.4.9+g09ee681+chromium-94.0.4606.71 / Chromium 94.0.4606.71 from https://cef-builds.spotifycdn.com/index.html

Installation

  1. Download the CEF SDK for your system from Spotify.
  2. Locate your installation of cefgo (typically in $GOPATH/src/github.com/Gurkengewuerz/cefgo or $GOPATH/pkg/mod/github.com/Gurkengewuerz/cefgo), and extract the CEF SDK.
    Copy include/* to cefgo/include
    Copy Release/* to cefgo/Release
    Copy Resources/* to cefgo/Release
  3. Run your binaries inside the Release folder

Usage on macOS

Because i don't have the opportunity to test cefgo on a mac i need your help. Theoretically cefgo should compile on macOS. Because macOS is different the application needs a bit more preperation.
Please read the CEF Wiki carefully and set up your enviroment. Feel free to share your experience.

About JS callbacks

Callbacks need to be registered before browsers are created. Currently only basic type conversions are supported (undefined/null, bool, int/uint, double, string). Objects and Arrays are possible, but not done. If you are running in multi-process mode (the default - as opposed to single-process) keep in mind the callback will be executed in the browser process and not in the main process.

DevTools

Set the a RemoteDebuggingPort in the Settings struct. Start your application and point your browser to http://127.0.0.1:<port>.

Updating the CEF Version

The process for updating CEF to a newer version is relatively simple.

  1. Download a new version from Spotify and extract.
  2. Update the headers inside the include folder
  3. Extract the new cef resources and libs to the Release folder
  4. Try to compile the test application: go clean -cache -testcache && CGO_ENABLED=1 go build -o Release/test.exe examples/main.go
  5. Fix any incompatibilities with new APIs until the application compiles.
  6. Push the new version, and update the version listed in this README.

cefgo's People

Contributors

gurkengewuerz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cefgo's Issues

More compact libcef.so?

I was looking through the release directory and it looks like the libcef.so that I downloaded is 1012 MB.... I'm surprised it's so big!

Is there a more compact version of this library?

Build Issue - Couldn't mmap icu data file

Hello!

I found your cefgo project via your post on the go-ultralight issue tracker
maneac/go-ultralight#9 (comment)

I was doing some testing with Ultralight and noticed that some very simple Vue.js wasn't even working... Curious to see how CEF compares... Definitely excellent that it's actually open source!

I am trying to build the example on Ubuntu 20.04, but I'm getting a core dump...

I was able to get the release to build, though note the Readme.md says to use examples/main.go but I think it's updated to examples/mainthead/main.go.

go clean -cache -testcache && CGO_ENABLED=1 go build -o Release/test examples/mainthread/main.go

Once it builds though, I'm unable to get the test app to launch:

❯ ./test
[example app]fillMainArgs [./test] 1
[example app]ExecuteProcess
[example app]Initialize Settings
[example app]ResourcesDirPath= /home/ryan/Dev/cefgo/Release
[example app]LocalesDirPath= /home/ryan/Dev/cefgo/Release/locales
[example app]RemoteDebuggingPort= 6696
[example app]IgnoreCertificateErrors= false
[example app]CommandLineArgsDisabled= false
[example app]fillMainArgs [./test] 1
init_gui
cef_initialize
on_before_command_line_processing
on_register_custom_schemes
[0904/203439.702504:ERROR:icu_util.cc(247)] Couldn't mmap icu data file
zsh: trace trap (core dumped)  ./test

I'm using:

cef_binary_85.3.1+g1306235+chromium-85.0.4183.83_linux64_minimal
go version go1.13.8 linux/amd64
Ubuntu 20.04.1 LTS (Focal Fossa)

how to increase the memory usage

hi, the application will be crash in single-process mode while the memory usage over 3.5G, and the application will be blank in not single-process mode. so how to fix it?

Doesn't work on a mac

[example app]fillMainArgs [./.app/Contents/MacOS/app --enable-logging --v=10] 3
[example app]ExecuteProcess
[example app]Initialize Settings
[example app]RemoteDebuggingPort= 6696
[example app]IgnoreCertificateErrors= false
[example app]CommandLineArgsDisabled= false
[example app]File /Users/aman/Projects/gomvc/icon.png does not exist
[example app]fillMainArgs [./
.app/Contents/MacOS/app --enable-logging --v=10] 3
init_gui
cef_initialize
on_before_command_line_processing
on_register_custom_schemes
[0915/113659.510557:VERBOSE1:pref_proxy_config_tracker_impl.cc(185)] 0xce58da0: set chrome proxy config service to 0xce5a4c0
[0915/113659.512004:VERBOSE1:webrtc_internals.cc(119)] Could not get the download directory.
get_browser_process_handler
[0915/113659.513443:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 1 time(s)
get_resource_bundle_handler
[0915/113659.520208:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_cookies_allowed_for_urls
[0915/113659.520248:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_cookies_blocked_for_urls
[0915/113659.520270:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_cookies_sessiononly_for_urls
[0915/113659.520289:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_images_allowed_for_urls
[0915/113659.520306:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_images_blocked_for_urls
[0915/113659.520323:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_insecure_content_allowed_for_urls
[0915/113659.520340:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_insecure_content_blocked_for_urls
[0915/113659.520357:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_javascript_allowed_for_urls
[0915/113659.520374:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_javascript_blocked_for_urls
[0915/113659.520391:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_notifications_allowed_for_urls
[0915/113659.520408:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_notifications_blocked_for_urls
[0915/113659.520425:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_plugins_allowed_for_urls
[0915/113659.520441:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_plugins_blocked_for_urls
[0915/113659.520458:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_popups_allowed_for_urls
[0915/113659.520474:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_popups_blocked_for_urls
[0915/113659.520491:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_web_usb_ask_for_urls
[0915/113659.520508:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_web_usb_blocked_for_urls
[0915/113659.520525:VERBOSE2:content_settings_policy_provider.cc(245)] Skipping unset preference: profile.managed_legacy_cookie_access_allowed_for_domains
[0915/113659.520542:VERBOSE2:content_settings_policy_provider.cc(313)] Skipping unset preference: profile.managed_auto_select_certificate_for_urls
initialize_window_delegate
cef_run_message_loop
[0915/113659.562396:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 2 time(s)
[0915/113659.563684:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 3 time(s)
[0915/113659.565045:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 4 time(s)
[0915/113659.566373:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 5 time(s)
[0915/113659.567625:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 6 time(s)
[0915/113659.567658:FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn't usable. Goodbye.

How to set the Window Position (Top, Left)?

I can see from the source and examples how to set the Width and Height of the browser window, but I don't see anything on setting the Top and Left position of the window...?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.