diff --git a/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java b/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java index 5b7b602..8aaced0 100644 --- a/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java +++ b/app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java @@ -2368,6 +2368,15 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse } } + /** + * Closes the specified view, implementing the JavaScript callback to close a window + * @param view the LightningView to close + */ + @Override + public void onCloseWindow(LightningView view) { + deleteTab(mWebViewList.indexOf(view)); + } + /** * returns the Activity instance for this activity, * very helpful when creating things in other classes... I think diff --git a/app/src/main/java/acr/browser/lightning/controller/BrowserController.java b/app/src/main/java/acr/browser/lightning/controller/BrowserController.java index bfb166b..90ec2bc 100644 --- a/app/src/main/java/acr/browser/lightning/controller/BrowserController.java +++ b/app/src/main/java/acr/browser/lightning/controller/BrowserController.java @@ -12,6 +12,8 @@ import android.webkit.ValueCallback; import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebView; +import acr.browser.lightning.view.LightningView; + public interface BrowserController { void updateUrl(String title, boolean shortUrl); @@ -36,6 +38,8 @@ public interface BrowserController { void onCreateWindow(Message resultMsg); + void onCloseWindow(LightningView view); + Activity getActivity(); void hideActionBar(); diff --git a/app/src/main/java/acr/browser/lightning/view/LightningView.java b/app/src/main/java/acr/browser/lightning/view/LightningView.java index 6a18532..5521c09 100644 --- a/app/src/main/java/acr/browser/lightning/view/LightningView.java +++ b/app/src/main/java/acr/browser/lightning/view/LightningView.java @@ -998,8 +998,7 @@ public class LightningView { @Override public void onCloseWindow(WebView window) { - // TODO Auto-generated method stub - super.onCloseWindow(window); + mBrowserController.onCloseWindow(LightningView.this); } public void openFileChooser(ValueCallback uploadMsg) {