Skip to content

Commit

Permalink
Add cache path to enable HTML5 localStorage. Enable flash (need to in…
Browse files Browse the repository at this point in the history
…stall

PPAPI Flash).
  • Loading branch information
ffd114 committed Oct 22, 2015
1 parent 324a053 commit 47a37a5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 12 additions & 4 deletions src/org/lunarproject/gw2route/Navi.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class Navi extends JPanel {
final static String FILENAME_TRANSLATIONS = "translations.ini";
final static String FILENAME_BOOKMARKS = "bookmarks.txt";
final static String REPO_URI = "https://bitbucket.org/ffd114/gw2route";
final static String UPDATE_URI = "https://bitbucket.org/ffd114/gw2route/downloads";

WindowPreset currentWindowPreset;
int ICON_HEIGHT = 16;
Expand Down Expand Up @@ -137,17 +138,24 @@ public Navi() throws InterruptedException
JPanel webBrowserPanel = new JPanel(new BorderLayout());
webBrowserPanel.setBorder(BorderFactory.createEmptyBorder());

String[] args = new String[] {"--enable-system-flash"};

// Initialize cefbrowser
CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
CefApp.addAppHandler(new CefAppHandlerAdapter(args) {
@Override
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
// Shutdown the app if the native CEF part is terminated
if (state == CefAppState.TERMINATED)
System.exit(0);
}
});

_settings = new CefSettings();
_cefApp = CefApp.getInstance(_settings);
_settings.cache_path = "cache";

// Add args to enable using flash

_cefApp = CefApp.getInstance(args, _settings);
_client = _cefApp.createClient();
_browser = _client.createBrowser(TheOptions.URL_HOMEPAGE, false, true);

Expand All @@ -168,7 +176,7 @@ public void stateHasChanged(org.cef.CefApp.CefAppState state) {
TheBrowser.setLocationBarVisible(false);
TheBrowser.setButtonBarVisible(false);
TheBrowser.setMenuBarVisible(false);*/

TheClassLoader = this.getClass().getClassLoader();

// Browser frame initializations in separate functions to reduce clutter
Expand Down Expand Up @@ -516,7 +524,7 @@ public void actionPerformed(ActionEvent e)
{
try
{
Desktop.getDesktop().browse(new URI(REPO_URI));
Desktop.getDesktop().browse(new URI(UPDATE_URI));
TheFrame.setState(Frame.ICONIFIED);
}
catch (IOException | URISyntaxException ex) {}
Expand Down
14 changes: 11 additions & 3 deletions src/org/lunarproject/gw2route/ResizableFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* edges and moveable from a custom title bar.
* Source: http://www.coderanch.com/t/415944/GUI/java/user-ve-undecorated-window-resizable
*/
import org.cef.CefApp;

import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.*;
import javax.swing.*;

public class ResizableFrame extends JFrame implements MouseMotionListener, MouseListener
Expand Down Expand Up @@ -50,6 +50,14 @@ private void Init(int pIniWidth, int pIniHeight)

setLocation(initialLocation);
setUndecorated(true);

addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
CefApp.getInstance().dispose();
dispose();
}
});
}

public void setMinimumSize(int pMinWidth, int pMinHeight)
Expand Down

0 comments on commit 47a37a5

Please sign in to comment.