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