Implement javascript close window method in the browser

This commit is contained in:
Anthony Restaino 2015-08-11 19:59:01 -04:00
parent c4e244a82b
commit 7e67770617
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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();

View File

@ -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<Uri> uploadMsg) {