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.content.res.Configuration;
20 import android.graphics.Bitmap;
21 import android.os.Bundle;
22 import android.view.ActionMode;
23 import android.view.KeyEvent;
24 import android.view.Menu;
25 import android.view.MenuItem;
26 import android.view.View;
27 import android.webkit.WebChromeClient.CustomViewCallback;
28 import android.webkit.WebView;
29 
30 import java.util.List;
31 
32 /**
33  * UI interface definitions
34  */
35 public interface UI {
36 
37     public static enum ComboViews {
38         History,
39         Bookmarks,
40         Snapshots,
41     }
42 
onPause()43     public void onPause();
44 
onResume()45     public void onResume();
46 
onDestroy()47     public void onDestroy();
48 
onConfigurationChanged(Configuration config)49     public void onConfigurationChanged(Configuration config);
50 
onBackKey()51     public boolean onBackKey();
52 
onMenuKey()53     public boolean onMenuKey();
54 
needsRestoreAllTabs()55     public boolean needsRestoreAllTabs();
56 
addTab(Tab tab)57     public void addTab(Tab tab);
58 
removeTab(Tab tab)59     public void removeTab(Tab tab);
60 
setActiveTab(Tab tab)61     public void setActiveTab(Tab tab);
62 
updateTabs(List<Tab> tabs)63     public void updateTabs(List<Tab> tabs);
64 
detachTab(Tab tab)65     public void detachTab(Tab tab);
66 
attachTab(Tab tab)67     public void attachTab(Tab tab);
68 
onSetWebView(Tab tab, WebView view)69     public void onSetWebView(Tab tab, WebView view);
70 
createSubWindow(Tab tab, WebView subWebView)71     public void createSubWindow(Tab tab, WebView subWebView);
72 
attachSubWindow(View subContainer)73     public void attachSubWindow(View subContainer);
74 
removeSubWindow(View subContainer)75     public void removeSubWindow(View subContainer);
76 
onTabDataChanged(Tab tab)77     public void onTabDataChanged(Tab tab);
78 
onPageStopped(Tab tab)79     public void onPageStopped(Tab tab);
80 
onProgressChanged(Tab tab)81     public void onProgressChanged(Tab tab);
82 
showActiveTabsPage()83     public void showActiveTabsPage();
84 
removeActiveTabsPage()85     public void removeActiveTabsPage();
86 
showComboView(ComboViews startingView, Bundle extra)87     public void showComboView(ComboViews startingView, Bundle extra);
88 
showCustomView(View view, int requestedOrientation, CustomViewCallback callback)89     public void showCustomView(View view, int requestedOrientation,
90             CustomViewCallback callback);
91 
onHideCustomView()92     public void onHideCustomView();
93 
isCustomViewShowing()94     public boolean isCustomViewShowing();
95 
onPrepareOptionsMenu(Menu menu)96     public boolean onPrepareOptionsMenu(Menu menu);
97 
updateMenuState(Tab tab, Menu menu)98     public void updateMenuState(Tab tab, Menu menu);
99 
onOptionsMenuOpened()100     public void onOptionsMenuOpened();
101 
onExtendedMenuOpened()102     public void onExtendedMenuOpened();
103 
onOptionsItemSelected(MenuItem item)104     public boolean onOptionsItemSelected(MenuItem item);
105 
onOptionsMenuClosed(boolean inLoad)106     public void onOptionsMenuClosed(boolean inLoad);
107 
onExtendedMenuClosed(boolean inLoad)108     public void onExtendedMenuClosed(boolean inLoad);
109 
onContextMenuCreated(Menu menu)110     public void onContextMenuCreated(Menu menu);
111 
onContextMenuClosed(Menu menu, boolean inLoad)112     public void onContextMenuClosed(Menu menu, boolean inLoad);
113 
onActionModeStarted(ActionMode mode)114     public void onActionModeStarted(ActionMode mode);
115 
onActionModeFinished(boolean inLoad)116     public void onActionModeFinished(boolean inLoad);
117 
setShouldShowErrorConsole(Tab tab, boolean show)118     public void setShouldShowErrorConsole(Tab tab, boolean show);
119 
120     // returns if the web page is clear of any overlays (not including sub windows)
isWebShowing()121     public boolean isWebShowing();
122 
showWeb(boolean animate)123     public void showWeb(boolean animate);
124 
getDefaultVideoPoster()125     Bitmap getDefaultVideoPoster();
126 
getVideoLoadingProgressView()127     View getVideoLoadingProgressView();
128 
bookmarkedStatusHasChanged(Tab tab)129     void bookmarkedStatusHasChanged(Tab tab);
130 
showMaxTabsWarning()131     void showMaxTabsWarning();
132 
editUrl(boolean clearInput, boolean forceIME)133     void editUrl(boolean clearInput, boolean forceIME);
134 
isEditingUrl()135     boolean isEditingUrl();
136 
dispatchKey(int code, KeyEvent event)137     boolean dispatchKey(int code, KeyEvent event);
138 
showAutoLogin(Tab tab)139     void showAutoLogin(Tab tab);
140 
hideAutoLogin(Tab tab)141     void hideAutoLogin(Tab tab);
142 
setFullscreen(boolean enabled)143     void setFullscreen(boolean enabled);
144 
setUseQuickControls(boolean enabled)145     void setUseQuickControls(boolean enabled);
146 
shouldCaptureThumbnails()147     public boolean shouldCaptureThumbnails();
148 
blockFocusAnimations()149     boolean blockFocusAnimations();
150 
onVoiceResult(String result)151     void onVoiceResult(String result);
152 }
153