Home | History | Annotate | Download | only in browser
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.browser;
     18 
     19 import android.app.Activity;
     20 import android.content.Context;
     21 import android.graphics.Bitmap;
     22 import android.net.Uri;
     23 import android.net.http.SslError;
     24 import android.os.Message;
     25 import android.view.KeyEvent;
     26 import android.view.View;
     27 import android.webkit.HttpAuthHandler;
     28 import android.webkit.SslErrorHandler;
     29 import android.webkit.ValueCallback;
     30 import android.webkit.WebChromeClient;
     31 import android.webkit.WebChromeClient.FileChooserParams;
     32 import android.webkit.WebView;
     33 
     34 import java.util.List;
     35 
     36 /**
     37  * WebView aspect of the controller
     38  */
     39 public interface WebViewController {
     40 
     41     Context getContext();
     42 
     43     Activity getActivity();
     44 
     45     TabControl getTabControl();
     46 
     47     WebViewFactory getWebViewFactory();
     48 
     49     void onSetWebView(Tab tab, WebView view);
     50 
     51     void createSubWindow(Tab tab);
     52 
     53     void onPageStarted(Tab tab, WebView view, Bitmap favicon);
     54 
     55     void onPageFinished(Tab tab);
     56 
     57     void onProgressChanged(Tab tab);
     58 
     59     void onReceivedTitle(Tab tab, final String title);
     60 
     61     void onFavicon(Tab tab, WebView view, Bitmap icon);
     62 
     63     boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
     64 
     65     boolean shouldOverrideKeyEvent(KeyEvent event);
     66 
     67     boolean onUnhandledKeyEvent(KeyEvent event);
     68 
     69     void doUpdateVisitedHistory(Tab tab, boolean isReload);
     70 
     71     void getVisitedHistory(final ValueCallback<String[]> callback);
     72 
     73     void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
     74             final String host, final String realm);
     75 
     76     void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
     77             String mimeType, String referer, long contentLength);
     78 
     79     void showCustomView(Tab tab, View view, int requestedOrientation,
     80             WebChromeClient.CustomViewCallback callback);
     81 
     82     void hideCustomView();
     83 
     84     Bitmap getDefaultVideoPoster();
     85 
     86     View getVideoLoadingProgressView();
     87 
     88     void showSslCertificateOnError(WebView view, SslErrorHandler handler,
     89             SslError error);
     90 
     91     void onUserCanceledSsl(Tab tab);
     92 
     93     boolean shouldShowErrorConsole();
     94 
     95     void onUpdatedSecurityState(Tab tab);
     96 
     97     void showFileChooser(ValueCallback<Uri[]> callback, FileChooserParams params);
     98 
     99     void endActionMode();
    100 
    101     void attachSubWindow(Tab tab);
    102 
    103     void dismissSubWindow(Tab tab);
    104 
    105     Tab openTab(String url, boolean incognito, boolean setActive,
    106             boolean useCurrent);
    107 
    108     Tab openTab(String url, Tab parent, boolean setActive,
    109             boolean useCurrent);
    110 
    111     boolean switchToTab(Tab tab);
    112 
    113     void closeTab(Tab tab);
    114 
    115     void bookmarkedStatusHasChanged(Tab tab);
    116 
    117     void showAutoLogin(Tab tab);
    118 
    119     void hideAutoLogin(Tab tab);
    120 
    121     boolean shouldCaptureThumbnails();
    122 }
    123