Chromium Browser 4.17.0.3

Glimmer Custom Widget

Gem Version Join the chat at https://gitter.im/AndyObtiva/glimmer

Chromium Browser is a Glimmer Custom Widget that brings Chromium support into the Glimmer DSL for SWT

SWT (Standard Widget Toolkit) started supporting the Chromium Browser in version 4.17 via the SWT.CHROMIUM SWT style.

In order for it to work however, it needs the SWT Chromium support libraries and the CEF Binaries as outlined in the SWT FAQ.

The Chromium Browser Glimmer Custom Widget automates the inclusion of Chromium support libraries by relying on bundler-download gem (details under setup)

Note: Gem version numbers are in sync with the SWT Chromium library versions. The first two numbers represent the SWT Chromium version number. The last two numbers represent the minor and patch versions of the Chromium Browser Glimmer Custom Widget.

Content

Platforms

  • Mac
  • Windows
  • Linux

Pre-requisites

Setup

The Chromium Browser gem includes downloads in a Downloadfile and relies on the the bundler-download Bundler plugin to automatically download extra files.

Glimmer Application

Option 1: Pre-Download Binaries via Bundler Plugin

Add the following to a Glimmer application Gemfile:

plugin 'bundler-download'

gem 'glimmer-cw-browser-chromium', '~> 4.17.0'

Run this twice (the first time to install the bundler-download plugin and the second time to activate it and download extra files at the end):

jruby -S bundle

(or just bundle if using RVM)

Option 2: Download Binaries on First Use without Bundler Plugin

This option is useful if you want to include the Chromium Browser as a passive available option without forcing apps to download large binary files if they do not need the feature.

Add the following to a Glimmer application Gemfile:

gem 'glimmer-cw-browser-chromium', '~> 4.17.0'

Run this:

jruby -S bundle

(or just bundle if using RVM)

The first time you use the browser(:chromium) widget, extra file downloads are initiated to obtain the CEF Binaries (if not downloaded already).

Glimmer Custom Shell gem or Glimmer Custom Widget gem

Both options 1 and 2 from Glimmer Application instructions are available for custom shells and custom widgets too.

When reusing in a Glimmer custom shell only (not custom widget), start by installing the bundler-download Bundler plugin manually:

bundle plugin install bundler-download

Afterwards, for both custom shells and custom widgets, add the following line to Gemfile (especially if you're using Jeweler/Juwelier):

gem 'glimmer-cw-browser-chromium', '~> 4.17.0'

Run this to install gem and download extra files at the end via bundler-download:

jruby -S bundle

(or just bundle if using RVM)

If not using Jeweler/Juwelier, add the following line to the gemspec:

s.add_runtime_dependency(%q<glimmer-cw-browser-chromium>.freeze, ['~> 4.17.0'])

Finally, just require the library in your code.

require 'glimmer-cw-browser-chromium'

Instructions

browser(:chromium) is the Glimmer GUI DSL keyword to use.

It is the same as the standard browser widget but with the :chromium SWT style.

Sample

Hello, Browser Chromium!

Glimmer code (from samples/browser-chromium/hello_browser_chromium.rb):

require_relative '../../lib/glimmer-cw-browser-chromium'

include Glimmer

shell {
  minimum_size 1024, 860
  browser(:chromium) {
    url 'https://brightonresort.com/about'
  }
}.open

Run:

glimmer sample:run[hello_browser_chromium]

Glimmer app:

Chromium Browser

Troubleshooting

If the Chromium Browser widget does not work for whatever reason due to missing or corrupt CEF Binaries, you may clear and redownload manually via bundle download commands (from bundler-download).

To show downloaded files, run:

bundle download show

This should print something like:

Showing downloaded files for /Users/User/.rvm/gems/jruby-9.2.13.0@glimmer-cw-video/gems/glimmer-cw-browser-chromium-4.17.0.3/Downloadfile
54070695 /Users/User/.rvm/gems/jruby-9.2.13.0@glimmer-cw-video/gems/glimmer-cw-browser-chromium-4.17.0.3/vendor/jars/mac/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar

To clear downloads, run:

bundle download clear

To redownload, run:

bundle download

Contributing to glimmer-cw-browser-chromium

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

License

MIT

Copyright (c) 2020 - Andy Maleh.

--

Built for Glimmer (Ruby Desktop Development GUI Library).