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 void showVoiceTitleBar(String title, List<String> results); 97 98 public void revertVoiceTitleBar(Tab tab); 99 100 public boolean onPrepareOptionsMenu(Menu menu); 101 102 public void updateMenuState(Tab tab, Menu menu); 103 104 public void onOptionsMenuOpened(); 105 106 public void onExtendedMenuOpened(); 107 108 public boolean onOptionsItemSelected(MenuItem item); 109 110 public void onOptionsMenuClosed(boolean inLoad); 111 112 public void onExtendedMenuClosed(boolean inLoad); 113 114 public void onContextMenuCreated(Menu menu); 115 116 public void onContextMenuClosed(Menu menu, boolean inLoad); 117 118 public void onActionModeStarted(ActionMode mode); 119 120 public void onActionModeFinished(boolean inLoad); 121 122 public void setShouldShowErrorConsole(Tab tab, boolean show); 123 124 // returns if the web page is clear of any overlays (not including sub windows) 125 public boolean isWebShowing(); 126 127 public void showWeb(boolean animate); 128 129 Bitmap getDefaultVideoPoster(); 130 131 View getVideoLoadingProgressView(); 132 133 void bookmarkedStatusHasChanged(Tab tab); 134 135 void showMaxTabsWarning(); 136 137 void editUrl(boolean clearInput); 138 139 boolean isEditingUrl(); 140 141 boolean dispatchKey(int code, KeyEvent event); 142 143 public static interface DropdownChangeListener { 144 void onNewDropdownDimensions(int height); 145 } 146 void registerDropdownChangeListener(DropdownChangeListener d); 147 148 void showAutoLogin(Tab tab); 149 150 void hideAutoLogin(Tab tab); 151 152 void setFullscreen(boolean enabled); 153 154 void setUseQuickControls(boolean enabled); 155 156 public boolean shouldCaptureThumbnails(); 157 158 } 159