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.WebView;
     32 
     33 import java.util.List;
     34 
     35 /**
     36  * WebView aspect of the controller
     37  */
     38 public interface WebViewController {
     39 
     40     Context getContext();
     41 
     42     Activity getActivity();
     43 
     44     TabControl getTabControl();
     45 
     46     WebViewFactory getWebViewFactory();
     47 
     48     void onSetWebView(Tab tab, WebView view);
     49 
     50     void createSubWindow(Tab tab);
     51 
     52     void onPageStarted(Tab tab, WebView view, Bitmap favicon);
     53 
     54     void onPageFinished(Tab tab);
     55 
     56     void onProgressChanged(Tab tab);
     57 
     58     void onReceivedTitle(Tab tab, final String title);
     59 
     60     void onFavicon(Tab tab, WebView view, Bitmap icon);
     61 
     62     boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
     63 
     64     boolean shouldOverrideKeyEvent(KeyEvent event);
     65 
     66     void onUnhandledKeyEvent(KeyEvent event);
     67 
     68     void doUpdateVisitedHistory(Tab tab, boolean isReload);
     69 
     70     void getVisitedHistory(final ValueCallback<String[]> callback);
     71 
     72     void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
     73             final String host, final String realm);
     74 
     75     void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
     76             String mimeType, long contentLength);
     77 
     78     void showCustomView(Tab tab, View view, int requestedOrientation,
     79             WebChromeClient.CustomViewCallback callback);
     80 
     81     void hideCustomView();
     82 
     83     Bitmap getDefaultVideoPoster();
     84 
     85     View getVideoLoadingProgressView();
     86 
     87     void showSslCertificateOnError(WebView view, SslErrorHandler handler,
     88             SslError error);
     89 
     90     void onUserCanceledSsl(Tab tab);
     91 
     92     void activateVoiceSearchMode(String title, List<String> results);
     93 
     94     void revertVoiceSearchMode(Tab tab);
     95 
     96     boolean shouldShowErrorConsole();
     97 
     98     void onUpdatedSecurityState(Tab tab);
     99 
    100     void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType);
    101 
    102     void endActionMode();
    103 
    104     void attachSubWindow(Tab tab);
    105 
    106     void dismissSubWindow(Tab tab);
    107 
    108     Tab openTab(String url, boolean incognito, boolean setActive,
    109             boolean useCurrent);
    110 
    111     Tab openTab(String url, Tab parent, boolean setActive,
    112             boolean useCurrent);
    113 
    114     boolean switchToTab(Tab tab);
    115 
    116     void closeTab(Tab tab);
    117 
    118     void setupAutoFill(Message message);
    119 
    120     void bookmarkedStatusHasChanged(Tab tab);
    121 
    122     void showAutoLogin(Tab tab);
    123 
    124     void hideAutoLogin(Tab tab);
    125 
    126     boolean shouldCaptureThumbnails();
    127 }
    128