UI.java revision 1acef69ffc079d1bc029ff7eb1f5043f7efd7f36
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
17package com.android.browser;
18
19import android.content.res.Configuration;
20import android.graphics.Bitmap;
21import android.os.Bundle;
22import android.view.ActionMode;
23import android.view.KeyEvent;
24import android.view.Menu;
25import android.view.View;
26import android.webkit.WebChromeClient.CustomViewCallback;
27import android.webkit.WebView;
28
29import java.util.List;
30
31/**
32 * UI interface definitions
33 */
34public interface UI {
35
36    public void onPause();
37
38    public void onResume();
39
40    public void onDestroy();
41
42    public void onConfigurationChanged(Configuration config);
43
44    public boolean onBackKey();
45
46    public boolean needsRestoreAllTabs();
47
48    public void addTab(Tab tab);
49
50    public void removeTab(Tab tab);
51
52    public void setActiveTab(Tab tab);
53
54    public void updateTabs(List<Tab> tabs);
55
56    public void detachTab(Tab tab);
57
58    public void attachTab(Tab tab);
59
60    public void onSetWebView(Tab tab, WebView view);
61
62    public void createSubWindow(Tab tab, WebView subWebView);
63
64    public void attachSubWindow(View subContainer);
65
66    public void removeSubWindow(View subContainer);
67
68    public void onTabDataChanged(Tab tab);
69
70    public void onPageStopped(Tab tab);
71
72    public void onProgressChanged(Tab tab);
73
74    public void showActiveTabsPage();
75
76    public void removeActiveTabsPage();
77
78    public void showComboView(boolean startWithHistory, Bundle extra);
79
80    public void hideComboView();
81
82    public void showCustomView(View view, CustomViewCallback callback);
83
84    public void onHideCustomView();
85
86    public boolean isCustomViewShowing();
87
88    public void showVoiceTitleBar(String title);
89
90    public void revertVoiceTitleBar(Tab tab);
91
92    public boolean onPrepareOptionsMenu(Menu menu);
93
94    public void onOptionsMenuOpened();
95
96    public void onExtendedMenuOpened();
97
98    public void onOptionsMenuClosed(boolean inLoad);
99
100    public void onExtendedMenuClosed(boolean inLoad);
101
102    public void onContextMenuCreated(Menu menu);
103
104    public void onContextMenuClosed(Menu menu, boolean inLoad);
105
106    public void onActionModeStarted(ActionMode mode);
107
108    public void onActionModeFinished(boolean inLoad);
109
110    public void setShouldShowErrorConsole(Tab tab, boolean show);
111
112    // returns if the web page is clear of any overlays (not including sub windows)
113    public boolean showsWeb();
114
115    Bitmap getDefaultVideoPoster();
116
117    View getVideoLoadingProgressView();
118
119    void bookmarkedStatusHasChanged(Tab tab);
120
121    void showMaxTabsWarning();
122
123    void editUrl(boolean clearInput);
124
125    boolean dispatchKey(int code, KeyEvent event);
126
127
128    public static interface DropdownChangeListener {
129        void onNewDropdownDimensions(int height);
130    }
131    void registerDropdownChangeListener(DropdownChangeListener d);
132}
133