blob: a9cbd7be40b38496067dd40ae0bf10bf53dcad2a [file] [log] [blame]
Michael Kolb8233fac2010-10-26 16:08:53 -07001/*
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
17package com.android.browser;
18
Michael Kolb8233fac2010-10-26 16:08:53 -070019import android.content.res.Configuration;
20import android.graphics.Bitmap;
21import android.os.Bundle;
22import android.view.ActionMode;
Michael Kolba4183062011-01-16 10:43:21 -080023import android.view.KeyEvent;
Michael Kolb8233fac2010-10-26 16:08:53 -070024import android.view.Menu;
Michael Kolb3ca12752011-07-20 13:52:25 -070025import android.view.MenuItem;
Michael Kolb8233fac2010-10-26 16:08:53 -070026import android.view.View;
27import android.webkit.WebChromeClient.CustomViewCallback;
Michael Kolb1514bb72010-11-22 09:11:48 -080028import android.webkit.WebView;
Michael Kolb8233fac2010-10-26 16:08:53 -070029
Michael Kolb1bf23132010-11-19 12:55:12 -080030import java.util.List;
31
Michael Kolb8233fac2010-10-26 16:08:53 -070032/**
33 * UI interface definitions
34 */
Michael Kolb66706532010-12-12 19:50:22 -080035public interface UI {
Michael Kolb8233fac2010-10-26 16:08:53 -070036
John Reck2bc80422011-06-30 15:11:49 -070037 public static enum ComboViews {
38 History,
39 Bookmarks,
40 Snapshots,
41 }
42
Michael Kolb8233fac2010-10-26 16:08:53 -070043 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
Michael Kolb2814a362011-05-19 15:49:41 -070053 public boolean onMenuKey();
54
Michael Kolb1bf23132010-11-19 12:55:12 -080055 public boolean needsRestoreAllTabs();
56
Michael Kolb8233fac2010-10-26 16:08:53 -070057 public void addTab(Tab tab);
58
59 public void removeTab(Tab tab);
60
61 public void setActiveTab(Tab tab);
62
Michael Kolb1bf23132010-11-19 12:55:12 -080063 public void updateTabs(List<Tab> tabs);
64
Michael Kolb8233fac2010-10-26 16:08:53 -070065 public void detachTab(Tab tab);
66
67 public void attachTab(Tab tab);
68
Michael Kolba713ec82010-11-29 17:27:06 -080069 public void onSetWebView(Tab tab, WebView view);
70
Michael Kolb1514bb72010-11-22 09:11:48 -080071 public void createSubWindow(Tab tab, WebView subWebView);
72
Michael Kolb8233fac2010-10-26 16:08:53 -070073 public void attachSubWindow(View subContainer);
74
75 public void removeSubWindow(View subContainer);
76
John Reck30c714c2010-12-16 17:30:34 -080077 public void onTabDataChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070078
79 public void onPageStopped(Tab tab);
80
John Reck30c714c2010-12-16 17:30:34 -080081 public void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070082
83 public void showActiveTabsPage();
84
85 public void removeActiveTabsPage();
86
John Reck2bc80422011-06-30 15:11:49 -070087 public void showComboView(ComboViews startingView, Bundle extra);
Michael Kolb8233fac2010-10-26 16:08:53 -070088
Derek Sollenberger2d4f1e22011-06-01 14:50:42 -040089 public void showCustomView(View view, int requestedOrientation,
90 CustomViewCallback callback);
Michael Kolb8233fac2010-10-26 16:08:53 -070091
92 public void onHideCustomView();
93
94 public boolean isCustomViewShowing();
95
Michael Kolb11d19782011-03-20 10:17:40 -070096 public void showVoiceTitleBar(String title, List<String> results);
Michael Kolb8233fac2010-10-26 16:08:53 -070097
98 public void revertVoiceTitleBar(Tab tab);
99
Michael Kolb1acef692011-03-08 14:12:06 -0800100 public boolean onPrepareOptionsMenu(Menu menu);
101
Michael Kolb7bdee0b2011-08-01 11:55:38 -0700102 public void updateMenuState(Tab tab, Menu menu);
103
Michael Kolb8233fac2010-10-26 16:08:53 -0700104 public void onOptionsMenuOpened();
105
106 public void onExtendedMenuOpened();
107
Michael Kolb3ca12752011-07-20 13:52:25 -0700108 public boolean onOptionsItemSelected(MenuItem item);
109
Michael Kolb8233fac2010-10-26 16:08:53 -0700110 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)
John Reck3ba45532011-08-11 16:26:53 -0700125 public boolean isWebShowing();
126
127 public void showWeb(boolean animate);
Michael Kolb8233fac2010-10-26 16:08:53 -0700128
129 Bitmap getDefaultVideoPoster();
130
131 View getVideoLoadingProgressView();
132
Leon Scroggins4cd97792010-12-03 15:31:56 -0500133 void bookmarkedStatusHasChanged(Tab tab);
Michael Kolb843510f2010-12-09 10:51:49 -0800134
135 void showMaxTabsWarning();
136
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800137 void editUrl(boolean clearInput);
138
Michael Kolb42c0c062011-08-02 12:56:06 -0700139 boolean isEditingUrl();
140
Michael Kolba4183062011-01-16 10:43:21 -0800141 boolean dispatchKey(int code, KeyEvent event);
142
Narayan Kamath5119edd2011-02-23 15:49:17 +0000143 public static interface DropdownChangeListener {
144 void onNewDropdownDimensions(int height);
145 }
146 void registerDropdownChangeListener(DropdownChangeListener d);
Patrick Scott92066772011-03-10 08:46:27 -0500147
148 void showAutoLogin(Tab tab);
149
150 void hideAutoLogin(Tab tab);
Michael Kolbc38c6042011-04-27 10:46:06 -0700151
152 void setFullscreen(boolean enabled);
Michael Kolb0241e752011-07-07 14:58:50 -0700153
154 void setUseQuickControls(boolean enabled);
155
John Reck1cf4b792011-07-26 10:22:22 -0700156 public boolean shouldCaptureThumbnails();
157
Michael Kolb8233fac2010-10-26 16:08:53 -0700158}