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